diff --git a/src/features/mop/menu.test.ts b/src/features/mop/menu.test.ts index f78862f..4edaeaf 100644 --- a/src/features/mop/menu.test.ts +++ b/src/features/mop/menu.test.ts @@ -15,6 +15,7 @@ void test('builds a Mop form with the selected target id', () => { type: 'string', helpText: 'Auto-filled from the selected item.', required: true, + disabled: true, defaultValue: 't1_comment', }); }); @@ -29,6 +30,7 @@ void test('defaults Mop moderation actions to remove only', () => { type: 'string', helpText: 'Auto-filled from the selected item.', required: true, + disabled: true, defaultValue: 't3_post', }, { diff --git a/src/features/mop/menu.ts b/src/features/mop/menu.ts index 11ac99e..985c56d 100644 --- a/src/features/mop/menu.ts +++ b/src/features/mop/menu.ts @@ -11,6 +11,7 @@ export function buildNukeForm(title: string, targetId: string): Form { type: 'string', helpText: 'Auto-filled from the selected item.', required: true, + disabled: true, defaultValue: targetId, }, { diff --git a/src/features/mop/nuke.ts b/src/features/mop/nuke.ts index 458c1ac..470e88b 100644 --- a/src/features/mop/nuke.ts +++ b/src/features/mop/nuke.ts @@ -212,6 +212,10 @@ export async function handleNukePost( const resolved = await getCurrentUserAndPost(props.postId); if ('success' in resolved) return resolved; + if (resolved.post.subredditId !== props.subredditId) { + return { success: false, message: 'You can only mop this subreddit.' }; + } + const permissionFailure = await verifyPostModerationPermissions( resolved.user, resolved.post.subredditName, @@ -240,6 +244,10 @@ export async function handleNuke(props: NukeProps): Promise { const resolved = await getCurrentUserAndComment(props.commentId); if ('success' in resolved) return resolved; + if (resolved.comment.subredditId !== props.subredditId) { + return { success: false, message: 'You can only mop this subreddit.' }; + } + const permissionFailure = await verifyPostModerationPermissions( resolved.user, resolved.comment.subredditName,