Fixes #185
@ -26,7 +26,7 @@ import {
|
||||
|
||||
export const modRouteLoader =
|
||||
(ndkContext: NDKContextType) =>
|
||||
async ({ params }: LoaderFunctionArgs) => {
|
||||
async ({ params, request }: LoaderFunctionArgs) => {
|
||||
const { naddr } = params
|
||||
if (!naddr) {
|
||||
log(true, LogType.Error, 'Required naddr.')
|
||||
@ -51,6 +51,14 @@ export const modRouteLoader =
|
||||
const loggedInUserPubkey =
|
||||
(userState?.user?.pubkey as string | undefined) || getFallbackPubkey()
|
||||
|
||||
// Check if editing and the user is the original author
|
||||
// Redirect if NOT
|
||||
const url = new URL(request.url)
|
||||
const isEditMode = url.pathname.includes('edit-mod')
|
||||
if (isEditMode && loggedInUserPubkey !== pubkey) {
|
||||
return redirect(appRoutes.mods)
|
||||
}
|
||||
|
||||
try {
|
||||
// Set up the filters
|
||||
// Main mod content
|
||||
|
Loading…
x
Reference in New Issue
Block a user