Fixes #185

Merged
enes merged 2 commits from fixes-1-7 into staging 2025-01-07 20:02:56 +00:00
Showing only changes of commit d4d7dde1ab - Show all commits

View File

@ -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