Repository navigation
Conversation
Users get three switches in their profile settings: email on new threads, on being @mentioned, and on replies to threads they posted in. Preferences are stored in three new person columns, added via ALTER TABLE migration on startup so existing databases keep working. Mentions are extracted from the rendered post HTML, so @references inside code blocks or links do not trigger mail, matching what the page displays. A user qualifying for both a mention and a reply notification for the same post receives only the mention mail. Banned/spammer ranks and unconfirmed email addresses are excluded. Recipients are resolved synchronously after the post is committed, but SMTP transfers run in the background, so posting never blocks or fails on mail errors; failures are logged and the existing 2-mails-per-hour-per-address rate limit applies. Also replaces the htmlgen <>span call in replaceMentions with newXmlTree: the former no longer compiles on Nim 2.2, and this file needed to build for the new extractMentions proc.
The JS backend hoists the loop variable into one shared object that is mutated in place per iteration, so capturing `category` in the closure made every menu item select the last category. Only primitives are safe to capture; hoist category.id and re-resolve the object on click. This made the categories browser test fail deterministically (categories.nim:147, expected "Announcements" got the last category).
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.
Summary
Adds opt-in email notifications with three switches in the user's profile settings:
Implementation
personcolumns (emailNewThreads,emailMentions,emailReplies), added to fresh databases bysetup_nimforumand to existing ones via an idempotentALTER TABLEmigration at startup./profile.jsonexposes the preferences;/saveProfilepersists them.extractMentionsinutils.nim), so@userinside code blocks or links does not trigger mail — exactly matching what the page highlights.Note for reviewers
replaceMentionsneeded its<>spanhtmlgen call replaced with an equivalentnewXmlTreecall because the former no longer compiles on Nim 2.2 (Invalid node kind nnkInfix for macros.$), andutils.nimmust build forextractMentions. Happy to split that into a separate PR if preferred.Testing