Skip to content

feat: add sepia filter - #62

Merged
serendipty01 merged 6 commits into
roostorg:mainfrom
serendipty01:add-sepia-filter
Jul 8, 2026
Merged

feat: add sepia filter#62
serendipty01 merged 6 commits into
roostorg:mainfrom
serendipty01:add-sepia-filter

Conversation

@serendipty01

@serendipty01 serendipty01 commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Context & Requests for Reviewers

Implement Sepia filter from #43 using https://tailwindcss.com/docs/filter-sepia

MRT

Screenshot 2026-07-07 at 8 13 34 PM

NCMEC

Screen.Recording.2026-07-07.at.8.36.25.PM.mov

Tests

(Optional) Rollout Plan

Summary by CodeRabbit

  • New Features
    • Added a moderator safety “Color Scheme” selector with sepia support across safety settings and manual review screens (alongside grayscale and no filter).
  • Bug Fixes
    • Preview images, thumbnails, and iframe-based previews now consistently apply the selected color scheme.
    • Sepia preferences are now persisted and restored reliably.
  • Tests
    • Updated UI tests and added coverage for color-scheme conversions, class mapping, and round-trip behavior.

@julietshen

Copy link
Copy Markdown
Member

Thank you for your PR! @evank28 what do you think?

@evank28 evank28 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.

Thanks for doing this!

Do you think it would be worth trying to adopt the Meta approach directly?
They released an NPM package that should get you sepia, blur, and a whole bunch of other filters with an import statement -- https://www.npmjs.com/package/content-review-filters?activeTab=code

@lswartsenburg did some work trying to demo how you can use the NPM package in your own react app here: https://github.com/lswartsenburg/run-content-filters

Comment thread client/src/webpages/settings/AccountSettings.tsx
Comment thread client/src/webpages/settings/OrgSafetySettings.tsx Outdated
Comment thread client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx Outdated
@cassidyjames cassidyjames added the wellness Affects user well-being, i.e. features like media obfuscation label May 21, 2026
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d63c6973-d1bd-4231-85ee-ea09a3946922

📥 Commits

Reviewing files that changed from the base of the PR and between 7ff6f00 and bd9447c.

⛔ Files ignored due to path filters (2)
  • client/src/graphql/generated.ts is excluded by !**/generated.ts
  • server/graphql/generated.ts is excluded by !**/generated.ts
📒 Files selected for processing (16)
  • client/src/models/safetySettings.test.ts
  • client/src/models/safetySettings.ts
  • client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx
  • client/src/webpages/settings/AccountSettings.tsx
  • client/src/webpages/settings/SettingsPage.test.tsx
  • client/src/webpages/settings/tabs/WellnessTab.tsx
  • db/src/scripts/api-server-pg/2026.07.07T14.27.13.add_sepia.sql
  • server/graphql/modules/user.ts
  • server/services/manualReviewToolService/modules/JobDecisioning.ts
  • server/services/userManagementService/dbTypes.ts
  • server/services/userManagementService/userManagementService.ts
🚧 Files skipped from review as they are similar to previous changes (14)
  • client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx
  • db/src/scripts/api-server-pg/2026.07.07T14.27.13.add_sepia.sql
  • client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx
  • server/services/userManagementService/dbTypes.ts
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx
  • client/src/models/safetySettings.test.ts
  • client/src/models/safetySettings.ts
  • server/graphql/modules/user.ts
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx
  • client/src/webpages/settings/tabs/WellnessTab.tsx
  • client/src/webpages/settings/SettingsPage.test.tsx
  • server/services/userManagementService/userManagementService.ts
  • client/src/webpages/settings/AccountSettings.tsx

📝 Walkthrough

Walkthrough

Adds sepia moderator-safety support across storage, GraphQL, shared color-scheme helpers, settings pages, and manual review rendering. The UI now uses a single color-scheme selector, and media previews and thumbnails can apply a sepia class alongside existing blur and grayscale behavior.

Changes

Sepia Safety Feature Implementation

Layer / File(s) Summary
Color scheme model
client/src/models/safetySettings.ts, client/src/models/safetySettings.test.ts
Defines the shared color-scheme literals, conversion helpers, class-name mapping, and tests for scheme conversion and CSS output.
Database, schema, and persistence
db/src/scripts/api-server-pg/2026.07.07T14.27.13.add_sepia.sql, server/services/userManagementService/dbTypes.ts, server/graphql/modules/user.ts, server/services/userManagementService/userManagementService.ts
Adds sepia storage, GraphQL fields, and read/write support in user management service methods.
Settings pages
client/src/webpages/settings/AccountSettings.tsx, client/src/webpages/settings/tabs/WellnessTab.tsx, client/src/webpages/settings/SettingsPage.test.tsx
Reworks personal and organization settings to load sepia, use a color-scheme select, and update the related tests.
Manual review rendering
client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx, client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx, client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx, client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx, client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx, client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx
Propagates sepia into manual review state, iframe payloads, preview images, and NCMEC review thumbnails, and replaces grayscale toggles with color-scheme selects.
JobDecisioning typing
server/services/manualReviewToolService/modules/JobDecisioning.ts
Adjusts the tuple typing used by the final status match expression.
Estimated code review effort: 3 (Moderate) ~30 minutes

Possibly related PRs

  • roostorg/coop#709: This PR extends the Wellness tab settings wiring that the main change updates with sepia and a color-scheme selector.
  • roostorg/coop#777: Both PRs touch IframeContentDisplayComponent.tsx and related manual-review iframe message handling.

Suggested reviewers: julietshen, juanmrad, vinaysrao1, cassidyjames, dom-notion

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: adding the sepia filter.
Description check ✅ Passed The description states the sepia-filter goal and includes the template sections, though Tests and Checklist are still sparse.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@serendipty01
serendipty01 marked this pull request as ready for review June 2, 2026 19:02
@serendipty01
serendipty01 requested a review from juanmrad as a code owner June 2, 2026 19:02
Copilot AI review requested due to automatic review settings June 2, 2026 19:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new “Sepia” moderator safety preference across DB, API (GraphQL), server service layer, and multiple client UI surfaces so users/orgs can toggle sepia rendering in manual review experiences.

Changes:

  • Added moderator_safety_sepia to Postgres tables and Kysely DB types.
  • Extended server user management service + GraphQL schema/types to read/write the new setting.
  • Updated multiple client settings screens and media viewers to toggle/apply the sepia CSS class.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
server/services/userManagementService/userManagementService.ts Plumbs moderatorSafetySepia through preference read/update paths.
server/services/userManagementService/dbTypes.ts Adds moderator_safety_sepia column typing for Kysely models.
server/graphql/modules/user.ts Exposes sepia setting in GraphQL types/inputs.
server/graphql/generated.ts Regenerates server GraphQL typings for sepia field.
db/src/scripts/api-server-pg/2026.06.02T16.28.55.add_sepia.sql Adds the new DB columns for sepia.
client/src/webpages/settings/OrgSafetySettings.tsx Adds org-default sepia toggle and applies sepia preview styling.
client/src/webpages/settings/AccountSettings.tsx Adds per-user sepia toggle and applies sepia preview styling.
client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx Applies sepia preference when rendering reviewed media.
client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx Adds sepia toggle and applies sepia styling in media viewer.
client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx Passes sepia option down to blurable image component.
client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx Adds sepia option and applies sepia class.
client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx Carries sepia through iframe messaging/options.
client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx Adds sepia toggle and applies sepia preview styling.
client/src/graphql/generated.ts Regenerates client GraphQL typings/queries for sepia field.

Comment thread db/src/scripts/api-server-pg/2026.07.07T14.27.13.add_sepia.sql
Comment thread server/services/userManagementService/userManagementService.ts
Comment thread server/services/userManagementService/userManagementService.ts
Comment thread client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx Outdated
Comment thread client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx Outdated
Comment thread client/src/webpages/settings/OrgSafetySettings.tsx Outdated
Comment thread client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx (1)

411-415: ⚡ Quick win

Consider providing defaults for defensive programming.

The destructuring doesn't provide default values for the safety settings, which is inconsistent with other files in this PR (e.g., IframeContentDisplayComponent.tsx line 43). While the GraphQL query should always return these fields, providing defaults is more defensive and ensures the media thumbnails render even if unexpected nulls are returned. Without defaults, the condition on lines 600-601 may prevent the confirmation grid from displaying media.

🛡️ Proposed fix to add defaults
   const {
-    moderatorSafetyBlurLevel,
-    moderatorSafetyGrayscale,
-    moderatorSafetyMuteVideo,
-    moderatorSafetySepia,
+    moderatorSafetyBlurLevel = 2 as BlurStrength,
+    moderatorSafetyGrayscale = true,
+    moderatorSafetyMuteVideo = true,
+    moderatorSafetySepia = false,
   } = data?.me?.interfacePreferences ?? {};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx`
around lines 411 - 415, The destructuring of interface preferences in
NCMECReviewUser.tsx (moderatorSafetyBlurLevel, moderatorSafetyGrayscale,
moderatorSafetyMuteVideo, moderatorSafetySepia) needs defensive defaults like in
IframeContentDisplayComponent.tsx; update the destructure from
data?.me?.interfacePreferences ?? {} to provide defaults (e.g.,
moderatorSafetyBlurLevel = 0, moderatorSafetyGrayscale = false,
moderatorSafetyMuteVideo = false, moderatorSafetySepia = false) so downstream
checks (the confirmation grid/media rendering) still run if GraphQL returns
nulls.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx`:
- Around line 411-415: The destructuring of interface preferences in
NCMECReviewUser.tsx (moderatorSafetyBlurLevel, moderatorSafetyGrayscale,
moderatorSafetyMuteVideo, moderatorSafetySepia) needs defensive defaults like in
IframeContentDisplayComponent.tsx; update the destructure from
data?.me?.interfacePreferences ?? {} to provide defaults (e.g.,
moderatorSafetyBlurLevel = 0, moderatorSafetyGrayscale = false,
moderatorSafetyMuteVideo = false, moderatorSafetySepia = false) so downstream
checks (the confirmation grid/media rendering) still run if GraphQL returns
nulls.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 32fddf45-e8cf-48a0-99cf-ab97506e62d0

📥 Commits

Reviewing files that changed from the base of the PR and between dc279b7 and d5f8b8f.

⛔ Files ignored due to path filters (2)
  • client/src/graphql/generated.ts is excluded by !**/generated.ts
  • server/graphql/generated.ts is excluded by !**/generated.ts
📒 Files selected for processing (12)
  • client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx
  • client/src/webpages/settings/AccountSettings.tsx
  • client/src/webpages/settings/OrgSafetySettings.tsx
  • db/src/scripts/api-server-pg/2026.06.02T16.28.55.add_sepia.sql
  • server/graphql/modules/user.ts
  • server/services/userManagementService/dbTypes.ts
  • server/services/userManagementService/userManagementService.ts

@serendipty01
serendipty01 force-pushed the add-sepia-filter branch 2 times, most recently from 92b842b to a666995 Compare June 2, 2026 19:34

@ThisIsMissEm ThisIsMissEm 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.

UI appears to have a squish on the checkbox toggle where it's tight against greyscale. I think this could be the fixed width or something to do with the flexbox.

@evank28

evank28 commented Jun 16, 2026

Copy link
Copy Markdown

@serendipty01 Have you had a chance to consider my comment above?

@serendipty01

Copy link
Copy Markdown
Contributor Author

@serendipty01 Have you had a chance to consider my comment above?

Hi @evank28 ,
Since, the sepia changes are complete, i think this can be merged. And we can do an overhaul of the wellness features using the library in a separate PR.

serendipty01 added a commit to serendipty01/coop that referenced this pull request Jul 7, 2026
Review feedback on roostorg#62 (taobojlen): grayscale and sepia can't both be
active, so the UI now presents a single Color Scheme select
(None | Grayscale | Sepia). The GraphQL/DB representation stays as two
booleans for backwards compatibility; client/src/models/safetySettings.ts
maps between them and the UI only ever writes one flag.

Also updates SettingsPage wellness tests that the sepia commit had left
asserting the old two-switch UI (and a save payload without
moderatorSafetySepia), and adds unit tests for the mapping.

Co-Authored-By: Claude

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
client/src/webpages/settings/AccountSettings.tsx (1)

640-648: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive preview image classes from the resolved color scheme, not raw flags.

The image classes independently check moderatorSafetyGrayscale/moderatorSafetySepia instead of using colorSchemeFromPreferences. The model explicitly documents "Grayscale wins if both flags are somehow set," but this raw-boolean approach could apply both Tailwind filters simultaneously if that edge case ever occurred, contradicting the model's own invariant. The same duplicated pattern exists in WellnessTab.tsx (lines 202-210).

Consider adding a small helper (e.g., in safetySettings.ts) that maps a resolved ModeratorSafetyColorScheme to a CSS class, and reuse it in both files.

♻️ Proposed refactor
+// in safetySettings.ts
+export function colorSchemeClassName(scheme: ModeratorSafetyColorScheme): string {
+  switch (scheme) {
+    case 'GRAYSCALE':
+      return 'grayscale';
+    case 'SEPIA':
+      return 'sepia';
+    default:
+      return '';
+  }
+}
           <img
             className={`rounded object-scale-down w-72 h-44 ${
               BLUR_LEVELS[safetySettings.moderatorSafetyBlurLevel] ?? 'blur-sm'
-            } ${safetySettings.moderatorSafetyGrayscale ? 'grayscale' : ''} ${
-              safetySettings.moderatorSafetySepia ? 'sepia' : ''
-            }`}
+            } ${colorSchemeClassName(colorSchemeFromPreferences(safetySettings))}`}
             alt="puppies"
             src={GoldenRetrieverPuppies}
           />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@client/src/webpages/settings/AccountSettings.tsx` around lines 640 - 648, The
preview image class logic in AccountSettings.tsx still reads
moderatorSafetyGrayscale and moderatorSafetySepia directly, which can apply
conflicting Tailwind filters instead of respecting the resolved color scheme.
Update the image class generation to use colorSchemeFromPreferences (or a small
shared helper in safetySettings.ts that maps a ModeratorSafetyColorScheme to the
CSS class) so grayscale/sepia are derived from the resolved state, then reuse
the same helper in WellnessTab.tsx as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/src/webpages/settings/tabs/WellnessTab.tsx`:
- Around line 82-122: The wellness settings form in WellnessTab stays dirty
after a successful save because the mutation only shows a toast and never
updates the baseline used by hasChanges. Update the save flow in
useGQLSetOrgDefaultSafetySettingsMutation so onCompleted either refetches
namedOperations.Query.OrgDefaultSafetySettings or resets
defaultInterfacePreferences-based local state to the saved values. Make sure the
comparison logic in hasChanges uses the refreshed baseline so “Save Changes”
disables after a successful save.

---

Nitpick comments:
In `@client/src/webpages/settings/AccountSettings.tsx`:
- Around line 640-648: The preview image class logic in AccountSettings.tsx
still reads moderatorSafetyGrayscale and moderatorSafetySepia directly, which
can apply conflicting Tailwind filters instead of respecting the resolved color
scheme. Update the image class generation to use colorSchemeFromPreferences (or
a small shared helper in safetySettings.ts that maps a
ModeratorSafetyColorScheme to the CSS class) so grayscale/sepia are derived from
the resolved state, then reuse the same helper in WellnessTab.tsx as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 78bf1778-2583-4341-abe6-3b2dd5c07044

📥 Commits

Reviewing files that changed from the base of the PR and between d5f8b8f and 7ff6f00.

⛔ Files ignored due to path filters (1)
  • client/src/graphql/generated.ts is excluded by !**/generated.ts
📒 Files selected for processing (12)
  • client/src/models/safetySettings.test.ts
  • client/src/models/safetySettings.ts
  • client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx
  • client/src/webpages/settings/AccountSettings.tsx
  • client/src/webpages/settings/SettingsPage.test.tsx
  • client/src/webpages/settings/tabs/WellnessTab.tsx
  • db/src/scripts/api-server-pg/2026.07.07T14.27.13.add_sepia.sql
✅ Files skipped from review due to trivial changes (1)
  • db/src/scripts/api-server-pg/2026.07.07T14.27.13.add_sepia.sql
🚧 Files skipped from review as they are similar to previous changes (5)
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx
  • client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🧹 Nitpick comments (1)
client/src/webpages/settings/AccountSettings.tsx (1)

640-648: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive preview image classes from the resolved color scheme, not raw flags.

The image classes independently check moderatorSafetyGrayscale/moderatorSafetySepia instead of using colorSchemeFromPreferences. The model explicitly documents "Grayscale wins if both flags are somehow set," but this raw-boolean approach could apply both Tailwind filters simultaneously if that edge case ever occurred, contradicting the model's own invariant. The same duplicated pattern exists in WellnessTab.tsx (lines 202-210).

Consider adding a small helper (e.g., in safetySettings.ts) that maps a resolved ModeratorSafetyColorScheme to a CSS class, and reuse it in both files.

♻️ Proposed refactor
+// in safetySettings.ts
+export function colorSchemeClassName(scheme: ModeratorSafetyColorScheme): string {
+  switch (scheme) {
+    case 'GRAYSCALE':
+      return 'grayscale';
+    case 'SEPIA':
+      return 'sepia';
+    default:
+      return '';
+  }
+}
           <img
             className={`rounded object-scale-down w-72 h-44 ${
               BLUR_LEVELS[safetySettings.moderatorSafetyBlurLevel] ?? 'blur-sm'
-            } ${safetySettings.moderatorSafetyGrayscale ? 'grayscale' : ''} ${
-              safetySettings.moderatorSafetySepia ? 'sepia' : ''
-            }`}
+            } ${colorSchemeClassName(colorSchemeFromPreferences(safetySettings))}`}
             alt="puppies"
             src={GoldenRetrieverPuppies}
           />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@client/src/webpages/settings/AccountSettings.tsx` around lines 640 - 648, The
preview image class logic in AccountSettings.tsx still reads
moderatorSafetyGrayscale and moderatorSafetySepia directly, which can apply
conflicting Tailwind filters instead of respecting the resolved color scheme.
Update the image class generation to use colorSchemeFromPreferences (or a small
shared helper in safetySettings.ts that maps a ModeratorSafetyColorScheme to the
CSS class) so grayscale/sepia are derived from the resolved state, then reuse
the same helper in WellnessTab.tsx as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/src/webpages/settings/tabs/WellnessTab.tsx`:
- Around line 82-122: The wellness settings form in WellnessTab stays dirty
after a successful save because the mutation only shows a toast and never
updates the baseline used by hasChanges. Update the save flow in
useGQLSetOrgDefaultSafetySettingsMutation so onCompleted either refetches
namedOperations.Query.OrgDefaultSafetySettings or resets
defaultInterfacePreferences-based local state to the saved values. Make sure the
comparison logic in hasChanges uses the refreshed baseline so “Save Changes”
disables after a successful save.

---

Nitpick comments:
In `@client/src/webpages/settings/AccountSettings.tsx`:
- Around line 640-648: The preview image class logic in AccountSettings.tsx
still reads moderatorSafetyGrayscale and moderatorSafetySepia directly, which
can apply conflicting Tailwind filters instead of respecting the resolved color
scheme. Update the image class generation to use colorSchemeFromPreferences (or
a small shared helper in safetySettings.ts that maps a
ModeratorSafetyColorScheme to the CSS class) so grayscale/sepia are derived from
the resolved state, then reuse the same helper in WellnessTab.tsx as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 78bf1778-2583-4341-abe6-3b2dd5c07044

📥 Commits

Reviewing files that changed from the base of the PR and between d5f8b8f and 7ff6f00.

⛔ Files ignored due to path filters (1)
  • client/src/graphql/generated.ts is excluded by !**/generated.ts
📒 Files selected for processing (12)
  • client/src/models/safetySettings.test.ts
  • client/src/models/safetySettings.ts
  • client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECMediaViewer.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx
  • client/src/webpages/settings/AccountSettings.tsx
  • client/src/webpages/settings/SettingsPage.test.tsx
  • client/src/webpages/settings/tabs/WellnessTab.tsx
  • db/src/scripts/api-server-pg/2026.07.07T14.27.13.add_sepia.sql
✅ Files skipped from review due to trivial changes (1)
  • db/src/scripts/api-server-pg/2026.07.07T14.27.13.add_sepia.sql
🚧 Files skipped from review as they are similar to previous changes (5)
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ManualReviewJobFieldsComponent.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobContentBlurableImage.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/v2/ncmec/NCMECReviewUser.tsx
  • client/src/webpages/dashboard/mrt/ManualReviewSafetySettings.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/IframeContentDisplayComponent.tsx
🛑 Comments failed to post (1)
client/src/webpages/settings/tabs/WellnessTab.tsx (1)

82-122: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the relevant files and generated operation names.
git ls-files | rg 'client/src/webpages/settings/tabs/WellnessTab\.tsx|client/src/webpages/settings/tabs/AccountSettings\.tsx|graphql/generated|OrgDefaultSafetySettings|AccountSettings'

printf '\n## WellnessTab.tsx\n'
ast-grep outline client/src/webpages/settings/tabs/WellnessTab.tsx --view expanded || true

printf '\n## AccountSettings.tsx\n'
ast-grep outline client/src/webpages/settings/tabs/AccountSettings.tsx --view expanded || true

printf '\n## Search for OrgDefaultSafetySettings\n'
rg -n "OrgDefaultSafetySettings|namedOperations\.Query\." client/src graphql -S || true

Repository: roostorg/coop

Length of output: 14859


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the relevant file sections directly.
printf '\n## WellnessTab.tsx lines 70-140\n'
sed -n '70,140p' client/src/webpages/settings/tabs/WellnessTab.tsx | cat -n

printf '\n## AccountSettings.tsx lines around the analogous save flow\n'
rg -n -A8 -B8 "refetchQueries|useGQL.*Mutation|namedOperations\.Query\.AccountSettings" client/src/webpages/settings/tabs/AccountSettings.tsx -S

printf '\n## Generated namedOperations entries\n'
rg -n "OrgDefaultSafetySettings|AccountSettings" client/src/graphql/generated* client/src -S || true

Repository: roostorg/coop

Length of output: 3321


Refetch the wellness settings query after save

hasChanges still compares against the original defaultInterfacePreferences, but this mutation doesn’t update that cache entry. After a successful save, the form can stay dirty and keep “Save Changes” enabled. Refetch namedOperations.Query.OrgDefaultSafetySettings or reset the local baseline in onCompleted so the saved state becomes the new baseline.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@client/src/webpages/settings/tabs/WellnessTab.tsx` around lines 82 - 122, The
wellness settings form in WellnessTab stays dirty after a successful save
because the mutation only shows a toast and never updates the baseline used by
hasChanges. Update the save flow in useGQLSetOrgDefaultSafetySettingsMutation so
onCompleted either refetches namedOperations.Query.OrgDefaultSafetySettings or
resets defaultInterfacePreferences-based local state to the saved values. Make
sure the comparison logic in hasChanges uses the refreshed baseline so “Save
Changes” disables after a successful save.

Shalabh Agarwal and others added 4 commits July 7, 2026 21:15
- Add sepia CSS filter option alongside blur, grayscale, mute-video
- Configurable per-user (AccountSettings) and per-org (OrgSafetySettings)
- Fix truthiness check: use != null instead of boolean coercion for all 4 safety booleans
- Fix missing sepia prop in MEDIA/IMAGE rendering path (ManualReviewJobFieldsComponent)
- Fix initial state to match DB DEFAULT false (5 components)
- Move migration from .devops/migrator/ to db/src/scripts/api-server-pg/
- Rename migration timestamp from 2026.02.12 to 2026.06.02T16.28.55
Review feedback on roostorg#62 (taobojlen): grayscale and sepia can't both be
active, so the UI now presents a single Color Scheme select
(None | Grayscale | Sepia). The GraphQL/DB representation stays as two
booleans for backwards compatibility; client/src/models/safetySettings.ts
maps between them and the UI only ever writes one flag.

Also updates SettingsPage wellness tests that the sepia commit had left
asserting the old two-switch UI (and a save payload without
moderatorSafetySepia), and adds unit tests for the mapping.

Co-Authored-By: Claude
serendipty01 and others added 2 commits July 7, 2026 21:15
… formatting

Drop defaultChecked from grayscale/mute-videos Switches in
ManualReviewSafetySettings and the grayscale Switch in NCMECMediaViewer
(they are controlled via checked, so defaultChecked is ignored and warns).
Remove a trailing-whitespace line and add a missing trailing comma.

Co-Authored-By: Claude <noreply@anthropic.com>

@julietshen julietshen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm and based on comments above - thanks for your contribution! Let's make sure to track any follow up work to refactor the wellness features with Meta's content review library :)

@serendipty01
serendipty01 requested a review from ThisIsMissEm July 8, 2026 17:52
@serendipty01

Copy link
Copy Markdown
Contributor Author

UI appears to have a squish on the checkbox toggle where it's tight against greyscale. I think this could be the fixed width or something to do with the flexbox.

@ThisIsMissEm i have moved to a dropdown design as can be seen in the attached video

@ThisIsMissEm

Copy link
Copy Markdown

Yeah, that makes sense.

@ThisIsMissEm
ThisIsMissEm dismissed their stale review July 8, 2026 18:27

Problem solved a different way.

@serendipty01
serendipty01 merged commit 2428fba into roostorg:main Jul 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wellness Affects user well-being, i.e. features like media obfuscation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants