Skip to content

feat: Add content follows feature for members to follow topics and posts - #941

Merged
aXenDeveloper merged 1 commit into
canaryfrom
claude/content-engine-follows-dcerp0
Nov 30, 2026
Merged

aXenDeveloper merged 1 commit into
canaryfrom
claude/content-engine-follows-dcerp0

Conversation

@aXenDeveloper

Copy link
Copy Markdown
Owner

Description

What?

Implements a complete content follows system allowing signed-in members to follow forum topics and blog posts, receiving notifications about new comments and replies. This includes:

  • Database schema: New core_content_follows table to track which members follow which content items
  • Follow routes: GET/PUT/DELETE /{id}/follow endpoints for managing follows with delivery preferences (in-app, email modes)
  • Notification integration: Extended threadReply notifications to support root followers with rootFollowers: true and messages.followed
  • Account settings: Follow preferences UI and API for managing default delivery modes and auto-follow behavior
  • React components: ContentFollowButton component with dropdown menu for delivery preferences and follow state management
  • Email delivery: Follow-aware email digest planning that respects follow preferences
  • Auto-follow: Automatic follow creation when members reply to content they don't already follow

Why?

This feature enhances member engagement by allowing them to stay updated on discussions they care about. Members can customize how they receive notifications (in-app only, immediate email, daily/weekly digests) and set account-wide defaults. The implementation integrates deeply with the existing notification system to ensure follows respect member preferences and email configuration.

Key Changes

  • Added follow: true option to defineContentType() for forum topics and blog posts
  • Extended buildContentNotifications() with rootFollowers: true and messages.followed for threadReply rules
  • New follow delivery preferences schema and account settings management
  • Follow state is excluded from shared public loaders to prevent cache issues
  • Comprehensive test coverage including PostgreSQL integration tests with 1277 lines
  • Documentation with implementation guide and API reference

Test Plan

Existing test suites cover the implementation:

  • follows.postgres.test.ts: 1277-line integration test covering follow creation, deletion, notification delivery, email digests, and multi-page follower scenarios
  • follow-button.test.tsx: React component tests for follow UI interactions and state management
  • settings-screen.test.tsx: Account settings tests for follow preferences
  • preferences.test.ts: Notification channel resolution with follow context
  • follow.test.ts: Follow preference resolution logic
  • query.test.ts: Follow query validation

CI passes with all tests included.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T20:56:59.071732Z fbc9fce New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

React Doctor found 16 new issues in 11 files · 16 warnings · score 71 / 100 (Needs work) · 9 fixed · vs canary

16 warnings

src/components/tiptap/quick-ask/quick-ask-popover.tsx

  • ⚠️ L215 Large component is hard to read and change no-giant-component
  • ⚠️ L215 React function has high control-flow complexity no-high-complexity-react-function
  • ⚠️ L328 Array lookup inside a loop js-set-map-lookups

src/components/tiptap/quick-ask/use-quick-ask-session.ts

  • ⚠️ L5 flushSync skips View Transitions no-flush-sync

src/content/server/follow-routes.ts

  • ⚠️ L190 Sequential independent awaits server-sequential-independent-await

src/content/server/notifications/process.ts

  • ⚠️ L819 await inside a loop async-await-in-loop

src/tanstack/follow/follow-button.tsx

  • ⚠️ L235 Prop derived into useState no-derived-useState
  • ⚠️ L251 preventDefault on a form or link no-prevent-default
  • ⚠️ L257 Floating .then in a JSX event handler no-floating-then-in-jsx-handler

src/views/admin/article/editor/frame.tsx

  • ⚠️ L45 Heading has no content heading-has-content

src/views/admin/article/editor/use-article-editor.tsx

  • ⚠️ L269 Array lookup inside a loop js-set-map-lookups

src/views/admin/layouts/search/search-dialog-content.tsx

  • ⚠️ L249 Large component is hard to read and change no-giant-component
  • ⚠️ L477 Autofocus on an element no-autofocus

src/views/admin/layouts/sidebar/nav/item-content.tsx

  • ⚠️ L47 React function has high control-flow complexity no-high-complexity-react-function

src/views/admin/views/content/actions/content-form.tsx

  • ⚠️ L400 array.find() inside a loop js-index-maps

src/views/notifications/settings/follow-card.tsx

  • ⚠️ L121 Heading has no content heading-has-content

Reviewed by React Doctor for commit fbc9fce. See inline comments for fixes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ccd91d91e2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +152 to +154
<FollowPreferencesCard
emailAvailable={emailChannelState(data.types) !== "unavailable"}
followEmailEnabled={data.followEmailEnabled}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include follow email in the account email switch state

When a member's per-type email modes are all none but an active follow uses email, followEmailEnabled defaults to true and follow emails still send. However, NotificationChannelsGroup still receives emailChannelState(data.types), so the account email switch appears off and cannot directly mute those emails; clicking it instead enables per-type emails. Derive the switch state from the follow email setting as well, so the displayed account-wide state agrees with delivery and members can stop follow emails without first enabling other notifications.

Useful? React with 👍 / 👎.

Comment on lines +153 to +154
if (query.isError) {
return (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve loaded follow settings after a refetch failure

If the initial settings request succeeds but a later background refetch fails, TanStack Query retains query.data while setting isError. This unconditional branch replaces the saved settings and all their controls with an empty state, making previously usable settings disappear during a transient failure. Restrict the empty state to errors without data and keep the controls visible with a warning and retry for background failures, as required by the repository's error-feedback guidance.

AGENTS.md reference: AGENTS.md:L81-L81

Useful? React with 👍 / 👎.

@aXenDeveloper aXenDeveloper changed the title Add content follows feature for members to follow topics and posts feat: Add content follows feature for members to follow topics and posts Nov 30, 2026
@github-actions github-actions Bot added the 💡 Feature A new feature label Nov 30, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf9025334b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

);
}

if (query.isError) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve loaded follow controls after a refetch failure

When a follow-state request succeeds but a later background refetch fails, TanStack Query retains query.data while setting isError. This branch replaces the existing Follow button and delivery menu with Retry, preventing the member from unfollowing or changing delivery even though their saved state is available. Restrict this replacement to failures without data; otherwise retain the controls and show a warning. AGENTS.md explicitly requires “Failed refetch over existing data → Alert variant="warning" above the content.”

AGENTS.md reference: AGENTS.md:L71-L71

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17f2ab7829

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +84 to +89
prepareRef.current ??= Promise.all([
importSearchAdminDialog(),
prepareIndex?.(),
])
.then(([module]) => {
setPreparedContent(() => module.SearchAdminDialogContent);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Render the palette before optional language requests finish

On a multilingual installation with uncached translations, opening the AdminCP palette waits for every other language's message request before mounting the searchable content. useAdminSearchIndex.prepare() awaits all those requests, so one slow request leaves the palette showing only a skeleton even though the dialog module and active-language index are ready. The 250 ms budget in useSearchMorph only opens the dialog; it does not release this dependency. Set PreparedContent when the module loads and warm the additional languages independently so users can search in the active language immediately.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 175de67087

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


const showDoc = (doc: PMNode, range: QuickAskRange) => {
const { state, view } = editor;
view.dispatch(state.tr.replaceWith(0, state.doc.content.size, doc.content));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve concurrent edits when switching Quick Ask versions

In a collaborative editor, another member can edit the document while the Quick Ask review bar remains open. showDoc replaces the entire current document with a saved snapshot, so choosing Original, Rewritten, Retry, or Undo discards any remote edits received since that snapshot, including changes outside the AI-edited selection, and propagates those deletions to collaborators. This affects the existing ContentLiveRichTextEditor collaboration binding and blog posts, which enable liveEditing. Apply a range-scoped, mapped change instead of restoring the whole document, or invalidate the review when intervening edits make restoration unsafe.

Useful? React with 👍 / 👎.

Comment on lines +194 to +196
selection: doc
.textBetween(from, to, "\n", " ")
.slice(0, QUICK_ASK_CLIENT_LIMITS.selection),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject oversized selections before replacing their full range

When a member selects more than 8,000 characters and runs Proofread or Rewrite, only the first 8,000 characters reach the model, but useQuickAskReview.commit passes the entire original selection range to applyQuickAskResult. The generated answer therefore replaces—and deletes—the unprocessed remainder of the selection. The previous flow prevented replacement through its stale-snapshot check, which is absent from the new runner. Reject oversized selections with feedback, process them completely, or restrict replacement to the text actually submitted.

Useful? React with 👍 / 👎.

- Record follows for threaded Content Engine roots, with auto-follow,
  follow preferences and follower notification delivery
- Follow control (icon list) and followers dialog in core, follow card
  in notification settings, wired into blog posts and forum topics
- Search key hints shared by header and AdminCP search dialogs
- Required relations for content types, slug sync from source fields
- Dashboard incoming items and sign-ups chart tooltips
- Tests for follow routes, persistence, config validation and UI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aXenDeveloper
aXenDeveloper force-pushed the claude/content-engine-follows-dcerp0 branch from 175de67 to fbc9fce Compare November 30, 2026 20:54
contentFollowAvailability(c, definition.id),
]);
// After the write, so the count includes this follow.
const followerCount = await countContentFollowers(c.get("db"), record);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/server-sequential-independent-await (warning)

This awaited initializer does not read the previous result. If the operations are independent asynchronous work, they may overlap; await syntax alone does not establish a speedup.

Fix → Consider Promise.all([...]) only for independent asynchronous work. Shared queues or synchronous work may not benefit. Preserve resource limits, transaction ordering, and failure/cancellation semantics.

Docs

}
if (firstPublishedAt) {
for (const rule of followerRules) {
await dispatchContentNotificationIntent(c, tx, {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/async-await-in-loop (warning)

This for…of loop waits before starting the next iteration. If iterations perform independent asynchronous work, consider bounded concurrency; await syntax alone does not establish a speedup.

Fix → Consider concurrent calls only for independent asynchronous work. Shared queues or synchronous work may not benefit. Preserve resource limits, transaction ordering, and failure/cancellation semantics; observe all callback promises.

Docs


const MORPH_MS = 300;

const QuickAskPanel = ({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-giant-component (warning)

Component "QuickAskPanel" is over 300 lines long, which is hard to read & change. Split it into a few smaller components.

Fix → Pull each section into its own component so the parent is easier to read, test, and change.

Docs


const MORPH_MS = 300;

const QuickAskPanel = ({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-high-complexity-react-function (warning)

QuickAskPanel has cyclomatic complexity 38, cognitive complexity 63, and maximum nesting depth 3, so its React logic is hard to understand and change. Extract independent branches into components or hooks.

Fix → Extract independent render branches and state logic into focused components or hooks until the control flow is easy to follow.

Docs

for (const group of selection ? SELECTION_GROUPS : CARET_GROUPS) {
for (const operation of group.operations) {
if (!allowed({ kind: "operation", operation })) continue;
if (!q && tiles.includes(operation)) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/js-set-map-lookups (warning)

This scales poorly because array.includes() inside a loop scans the whole list every time. Use a Set for constant-time lookups.

Fix → Use a Set or Map when you check for the same items over and over. Array.includes/find scans the whole list each time

Docs

aria-expanded={entries.length > 0}
aria-label={t("search.label")}
autoComplete="off"
autoFocus

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-autofocus (warning)

autoFocus moves focus on load, which can disrupt screen reader and keyboard users. Remove it and let users choose where to focus.

Fix → Do not use autoFocus. It disorients users on load.

Docs

continue;
}

const source = spec.fields.find(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/js-index-maps (warning)

This gets slow as your list grows because array.find() runs inside a loop, so build a Map once before the loop for instant lookups

Fix → Build a Map once before the loop instead of calling array.find(...) inside it

Docs


const header = (
<FrameHeader>
<FrameTitle id={titleId} render={<h2 />}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/heading-has-content (warning)

Blind users can't use this heading to navigate because screen readers skip it empty, so add text, aria-label, or aria-labelledby.

Fix → Put readable text in every heading.

Docs

<FrameTitle
className="flex items-center gap-2"
id={titleId}
render={<h2 />}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/heading-has-content (warning)

Blind users can't use this heading to navigate because screen readers skip it empty, so add text, aria-label, or aria-labelledby.

Fix → Put readable text in every heading.

Docs

field => statusOf(field, language.code) === "missing",
).length,
name: language.name,
outdated: outdated.includes(language.code),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/js-set-map-lookups (warning)

This scales poorly because array.includes() inside a loop scans the whole list every time. Use a Set for constant-time lookups.

Fix → Use a Set or Map when you check for the same items over and over. Array.includes/find scans the whole list each time

Docs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fbc9fce1ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +374 to +375
setQuery("");
void review.write(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Engage the Quick Ask session before running a clicked action

When a member selects text and clicks Proofread or Rewrite directly in the automatically opened popover, the session still has focus: false: the option's mouse-down handler preserves editor focus, and choose never calls quickAsk.focusPrompt(). Applying the answer collapses the editor selection, so the selection-settle handler in useQuickAskSession closes the session after 220 ms. The Original/Rewritten, Retry, and Undo controls consequently disappear before the member can review the replacement. Mark the session as engaged before starting the AI action so selection updates caused by applying its answer do not dismiss the review.

Useful? React with 👍 / 👎.

);
}

if (query.isError) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve loaded followers when a subsequent request fails

After the first followers page loads, a failed next-page request or background refetch sets query.isError while retaining the loaded pages. This unconditional branch replaces those usable followers with an empty error state, so scrolling into a transient pagination failure makes the entire list disappear. Restrict the replacement to errors without data; retain existing rows and expose a warning with an appropriate retry for subsequent failures. AGENTS.md requires failed refetches over existing data to show an Alert variant="warning" above the content.

AGENTS.md reference: AGENTS.md:L71-L71

Useful? React with 👍 / 👎.

@aXenDeveloper
aXenDeveloper merged commit f487c19 into canary Nov 30, 2026
7 checks passed
@aXenDeveloper
aXenDeveloper deleted the claude/content-engine-follows-dcerp0 branch November 30, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 Feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant