Repository navigation
guard: Show commenters why their comment was rejected - #1129
Merged
jelmer merged 1 commit intoSep 15, 2026
Merged
Conversation
Guard.validate() returned only True/False and a raw internal message,
which comments.py raised as an 403 Forbidden with that message
as the body. The JS client just console.error'd it, so a rejected
commenter (rate limit, direct-reply cap, reply-to-self, missing
email/author) saw nothing.
Split the internal message into a machine-readable reason code (e.g.
"ratelimit", "reply-to-self") and a human-readable message. The
reason is returned as JSON ({"reason": ...}, 403) instead of raising
Forbidden; the message keeps going to comments.new:guard for logging
and extensions. isso.js maps reason -> "guard-" + reason i18n key and
shows it inline in the postbox, falling back to a generic "guard-
error" text for unknown reasons.
Part of isso-comments#446
jelmer
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
CHANGES.rstbecause this is a user-facing change or an important bugfixWhat changes does this Pull Request introduce?
Guard rejections (rate limit, direct-reply cap, reply-to-self, missing email/author) used to just raise a 403 with an internal-only message; the JS client only console.error'd it, so commenters saw nothing.
Guard.validate()now returns(valid, reason, message):reasonis a stable machine-readable code (ratelimit,direct-reply,reply-to-self,require-email,require-author),messagestays the human-readable log/extension text./newreturns{"reason": ...}as JSON 403 instead of raisingForbidden(message).reasonto aguard-<reason>i18n key and shows it inline above the submit button, falling back to a genericguard-errormessage for unknown reasons.Why is this necessary?
Part of #446