Skip to content

Add showAuthorColors padOption to default authorship colors off#7510

Closed
JohnMcLear wants to merge 4 commits intodevelopfrom
feature/show-author-colors-default
Closed

Add showAuthorColors padOption to default authorship colors off#7510
JohnMcLear wants to merge 4 commits intodevelopfrom
feature/show-author-colors-default

Conversation

@JohnMcLear
Copy link
Copy Markdown
Member

Summary

Adds padOptions.showAuthorColors (default: true) so admins can default authorship colors to off for new users who haven't set a preference yet.

"padOptions": {
  "showAuthorColors": false
}

Priority order:

  1. User's cookie preference (always wins — users can still toggle colors on/off)
  2. Server padOptions.showAuthorColors setting (applied when no cookie exists)
  3. Built-in default (true — preserves existing behavior)

The existing noColors option is unchanged — it completely disables the color toggle. showAuthorColors: false just changes the default checkbox state.

Fixes

Closes #5563

Changes

  • Settings.ts: add to padOptions type and defaults
  • pad.ts: process from padOptions, apply as initial default, cookie overrides
  • SocketIOMessage.ts: add to PadOption type
  • settings.json.template + settings.json.docker: document the new option

Test plan

  • Default config (showAuthorColors: true): colors on by default (existing behavior)
  • Set showAuthorColors: false: colors off for new users, checkbox unchecked
  • User enables colors via checkbox → cookie saves true → persists across reloads
  • User with existing cookie preference is not affected by server setting change

🤖 Generated with Claude Code

Adds a new padOptions.showAuthorColors setting (default: true) that
lets admins default authorship colors to off for new users. Users can
still toggle colors on via the checkbox — their cookie preference
always overrides the server default.

- Settings.ts: add showAuthorColors to padOptions type and defaults
- pad.ts: process showAuthorColors from padOptions, apply as default,
  ensure cookie preference (true or false) overrides server setting
- settings.json.template + settings.json.docker: document the option
- SocketIOMessage.ts: add to PadOption type

Fixes #5563

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Add showAuthorColors padOption to default authorship colors off

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add showAuthorColors padOption to control authorship colors default state
• Implement priority system: user cookie preference overrides server setting
• Preserve existing behavior with default value of true
• Update type definitions and configuration templates with new option
Diagram
flowchart LR
  A["Server padOptions<br/>showAuthorColors"] --> B["Initial Default<br/>for New Users"]
  C["User Cookie<br/>Preference"] --> D["Final State<br/>Colors On/Off"]
  B --> D
  C -->|"Overrides"| D
  E["noColors Setting<br/>Completely Disables"] -.->|"Unchanged"| D
Loading

Grey Divider

File Changes

1. src/node/utils/Settings.ts ✨ Enhancement +2/-0

Add showAuthorColors to padOptions type and defaults

• Add showAuthorColors: boolean to padOptions type definition
• Set default value to true to preserve existing behavior
• Maintain backward compatibility with existing pad options

src/node/utils/Settings.ts


2. src/static/js/pad.ts ✨ Enhancement +19/-1

Process showAuthorColors from padOptions and apply defaults

• Add showAuthorColors parameter handler to check for 'false' value
• Set settings.showAuthorColorsDisabled flag when parameter is false
• Refactor cookie preference logic to handle explicit true/false states
• Apply server default only when no cookie preference exists
• Add initialization logic to apply server default before user interaction

src/static/js/pad.ts


3. src/static/js/types/SocketIOMessage.ts ✨ Enhancement +1/-0

Add showAuthorColors to PadOption type definition

• Add optional showAuthorColors boolean field to PadOption type
• Maintain consistency with other pad option type definitions

src/static/js/types/SocketIOMessage.ts


View more (2)
4. settings.json.template 📝 Documentation +1/-0

Document showAuthorColors in settings template

• Add showAuthorColors: true to padOptions configuration section
• Document the new option with default value matching code defaults

settings.json.template


5. settings.json.docker ⚙️ Configuration changes +1/-0

Add showAuthorColors to Docker configuration

• Add showAuthorColors with environment variable substitution
• Set default to true via PAD_OPTIONS_SHOW_AUTHOR_COLORS env var
• Enable Docker deployments to configure the option via environment

settings.json.docker


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects Bot commented Apr 14, 2026

Code Review by Qodo

🐞 Bugs (0)   📘 Rule violations (1)   📎 Requirement gaps (0)
📘\ ☼ Reliability (1)

Grey Divider


Remediation recommended

1. No test for showAuthorColors 📘
Description
This PR changes pad initialization behavior for authorship colors via the new
padOptions.showAuthorColors defaulting logic, but does not add any automated regression test to
prevent future breakage. This violates the requirement that bug fixes include a regression test that
would fail if the fix is removed.
Code

src/static/js/pad.ts[R568-573]

+    // If showAuthorColors is set to false in padOptions, default colors off.
+    // The user can still toggle them on via the checkbox; the cookie will
+    // override this default on subsequent visits.
+    if (settings.showAuthorColorsDisabled === true) {
+      this.changeViewOption('showAuthorColors', false);
+    }
Evidence
PR Compliance ID 4 requires a regression test for bug fixes. The diff adds new behavior that
defaults showAuthorColors off based on padOptions, but there are no corresponding test
additions/updates in the PR diff to validate this behavior (e.g., default-off + cookie override
precedence).

src/static/js/pad.ts[568-573]
Best Practice: Repository guidelines

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR introduces new defaulting behavior for authorship colors (`padOptions.showAuthorColors` + cookie precedence), but no automated regression test is included.

## Issue Context
A test should fail if the new defaulting/override behavior is removed, ensuring the intended priority order remains stable over time.

## Fix Focus Areas
- src/static/js/pad.ts[568-573]
- src/static/js/pad.ts[471-476]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

JohnMcLear and others added 2 commits April 14, 2026 13:02
- Fix pre-existing bug: noColors query param disabled colors but left
  the checkbox checked. Now the checkbox correctly reflects the state.
- Add Playwright tests for:
  - Default checkbox state (checked)
  - noColors=true unchecks the checkbox
  - Toggling the checkbox works

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to set Authorship colors default to false

1 participant