Skip to content

[Bugfix:Forum] Fix OP badge on anonymous toggle#12442

Merged
bmcutler merged 1 commit intoSubmitty:mainfrom
Akarshkushwaha:bugfix-forum-anonymous-toggle
Mar 7, 2026
Merged

[Bugfix:Forum] Fix OP badge on anonymous toggle#12442
bmcutler merged 1 commit intoSubmitty:mainfrom
Akarshkushwaha:bugfix-forum-anonymous-toggle

Conversation

@Akarshkushwaha
Copy link
Contributor

Why is this Change Important & Necessary?

Fixes #11755

This change is necessary because toggling the anonymity of a student in the Instructor Discussion Forum (using the "eye" icon) causes the Original Poster (OP) badge to disappear from the DOM. Additionally, toggling back to "Anonymous" hardcodes the text color to black when the site is set to Dark Mode.

What is the New Behavior?

  • The Original Poster (OP) badge is preserved and accurately displayed when revealing or hiding a student's real name.
  • Toggling back to "Anonymous" on Dark Mode correctly inherits the default white text color instead of switching to pure black.
  • [site/app/templates/forum/CreatePost.twig] now wraps visible_username inside a targeted .author-name span so JavaScript does not overwrite sibling elements (like the OP badge).
  • [site/public/js/server.js] [changeName()] function now cleanly targets .author-name and removes the color property instead of overriding it, keeping CSS inheritance intact for dark mode.

Before:-
image

After:-
image
image

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. Open up the Submitty instance as an instructor.
  2. Ensure you have the site set to Dark Mode.
  3. Locate an anonymous post/thread on the Discussion Forum where the anonymous user is the Original Poster.
  4. Click the 'eye' icon to deanonymize the student.
  5. Verify the "OP" badge remains visible next to the student's real name.
  6. Click the 'eye' icon again to return the status to "Anonymous".
  7. Verify that the word "Anonymous" returns to the standard white color, instead of changing to black text.

Automated Testing & Documentation

N/A - This is a CSS and DOM structure change that requires manual UI verification in the browser to confirm dark/light mode behavior.

Other information

This is not a breaking change.
No migrations are required.
No security concerns.

@Akarshkushwaha
Copy link
Contributor Author

Akarshkushwaha commented Feb 20, 2026

Hi @bmcutler @williamjallen, I've implemented a fix for issue #11755
The OP badge is now preserved when deanonymizing a student, and the "Anonymous" text color incorrectly switching to black in Dark Mode has been resolved. The PR is ready for review whenever you have a moment. Let me know if you need any adjustments or further changes

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.70%. Comparing base (5dbdc9b) to head (fa69514).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #12442   +/-   ##
=========================================
  Coverage     21.70%   21.70%           
  Complexity     9626     9626           
=========================================
  Files           268      268           
  Lines         36188    36188           
  Branches        486      486           
=========================================
  Hits           7856     7856           
  Misses        27850    27850           
  Partials        482      482           
Flag Coverage Δ
autograder 21.39% <ø> (ø)
js 2.04% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.74% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 90.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Akarshkushwaha Akarshkushwaha changed the title [Bugfix:Forum] Keep OP badge and colors when toggling anonymity [Bugfix:Forum] Fix OP badge on anonymous toggle Feb 20, 2026
@github-project-automation github-project-automation bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Feb 20, 2026
@automateprojectmangement automateprojectmangement bot moved this from Work in Progress to In Review in Submitty Development Feb 21, 2026
@github-project-automation github-project-automation bot moved this from In Review to Work in Progress in Submitty Development Feb 21, 2026
Fixes Submitty#12442

Targets the specific .author-name span during the JS changeName event to avoid deleting the sibling OP badge. Removes hardcoded black color for dark-mode compatibility.
@Akarshkushwaha Akarshkushwaha force-pushed the bugfix-forum-anonymous-toggle branch from 8c88bdf to fa69514 Compare February 21, 2026 16:54
@automateprojectmangement automateprojectmangement bot moved this from Work in Progress to In Review in Submitty Development Feb 22, 2026
Copy link
Member

@williamjallen williamjallen left a comment

Choose a reason for hiding this comment

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

Changes seem reasonable to me, but I'll defer a formal approval to whoever does a functionality review.

@williamjallen williamjallen dismissed their stale review February 28, 2026 03:46

Changes resolved.

Copy link
Contributor

@JManion32 JManion32 left a comment

Choose a reason for hiding this comment

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

I did a functionality review and was able to verify that the color of the name is as expected on light and dark mode, and the OP badge no longer disappears when revealing the name. Great work!

@github-project-automation github-project-automation bot moved this from In Review to Awaiting Maintainer Review in Submitty Development Mar 4, 2026
@williamjallen williamjallen moved this from Awaiting Maintainer Review to Ready to Merge in Submitty Development Mar 5, 2026
@bmcutler bmcutler merged commit 292d61f into Submitty:main Mar 7, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Toggle Anonymous Mode slightly incorrect colors

4 participants