You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: hold first posts for review, and promote into groups an operator made (#251)
Two bugs found while checking the deleted administrator reference against
the code for MEI-124. Both are configuration that silently does nothing.
`antispam.moderate_first_posts` asked whether the author bypasses
moderation with `authorizer.can(actor, 'content.viewUnapproved')` and no
target. That action is forum-scoped, so the call threw, the surrounding
catch logged a warning and returned false, and the post was not held. It
failed open for exactly the ordinary new members the setting exists to
catch: administrators and awaiting-activation members never reached the
throw. The line above it in reply-core already passed the scope.
The target is now required, so no caller can omit it — both call sites had
one in hand and the compiler found them. The catch that swallowed this is
split in two: a threshold it cannot read leaves the feature off, which is
what an unset threshold means anyway, while a bypass it cannot resolve
holds the post. Holding a post that did not need holding is undone by a
moderator; publishing spam is not.
Promotion rules ranked an unranked group 0 and treated a lower rank as a
demotion, so every rule into a group the operator created — Registered
ranks 2 — was refused. That is every rule a board would write, since the
seeded groups are guests, registered, moderators and administrators. The
guard now compares only ranks it knows, which loses nothing: a candidate
already in a protected group is skipped before the comparison, so
protectedGroupIds is what keeps staff safe, and a real demotion between
two ranked groups is still refused.
promotion.test.ts passed throughout because its fixture ranks the custom
group; the shipped guards cannot. The regression test is in
packages/runtime against `defaultPromotionGuards()` itself.
The antispam mock now throws for a forum-scoped action with no target, the
way the real authorizer does. Without that it agreed with the bug.
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments