Skip to content

[Feature:Forum] Pinned reply as announcement#12526

Merged
bmcutler merged 26 commits into
Submitty:mainfrom
jndlansh:feature/reply-as-anouncements
Jun 15, 2026
Merged

[Feature:Forum] Pinned reply as announcement#12526
bmcutler merged 26 commits into
Submitty:mainfrom
jndlansh:feature/reply-as-anouncements

Conversation

@jndlansh

@jndlansh jndlansh commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Closes #12333

Related to discussion in the forum about improving announcement capabilities for pinned threads. Currently, when instructors reply to pinned threads (which often contain important announcements), the replies are sent as regular notifications that students may overlook. This feature allows instructors to send announcement-level notifications when replying to pinned threads, ensuring students receive the same level of notification as initial announcements.

What is the New Behavior?

When an instructor or TA replies to a pinned thread, they now see an additional checkbox option: "Notify students (w/email) (pinned thread reply)" or "Notify students (pinned thread reply)" depending on whether email is enabled.

Before:

  • Replies to pinned threads sent as regular post notifications
  • No way to emphasize important updates to pinned announcements
Screenshot 2026-03-04 172543

After:

Screenshot 2026-03-04 175124 Screenshot 2026-03-04 175738
  • New checkbox appears when replying to pinned threads (only visible to instructors/TAs with full grading access)
  • Checking the box sends the reply as an announcement notification instead of a regular post notification
  • Notification subject: "Update to Pinned Thread: [Thread Title]"
  • Verification ensures thread is actually pinned before sending announcement
  • Falls back to regular notification if thread is not pinned
  • JavaScript confirmation dialog on submit: "You are about to send an announcement notification to all students. This should only be used for important updates to pinned threads. Continue?"

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

  1. Log in as an instructor
  2. Navigate to the forum
  3. Create a new thread and pin it (or use an existing pinned thread)
  4. Click "Reply" on the pinned thread
  5. Verify that a checkbox labeled "Notify students (pinned thread reply)" appears below the post editor
  6. Enter a reply message
  7. Check the "Notify students (pinned thread reply)" checkbox
  8. Click "Submit Post"
  9. Verify confirmation dialog appears: "You are about to send an announcement notification..."
  10. Confirm the submission
  11. Verify the notification is sent as an announcement (check notifications list)
  12. Try replying to a non-pinned thread and verify the checkbox does NOT appear

Automated Testing & Documentation

Other information

No Breaking : I verified the CI tests.
Screenshot 2026-03-03 225706

Migrations: None required - uses existing database schema and notification infrastructure

Security Concerns:

  • Feature restricted to users with accessFullGrading() permission
  • Verification step ensures thread is actually pinned before sending announcement
  • Falls back to regular notification if verification fails

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

Hello @jndlansh, thank you for your contribution! 2 things:

  1. Please include a screenshot of UI updates
  2. Does this close #12333? If so, please prefix the issue with "fixes" or "closes" instead of "related to". That way, the issue will automatically closed when this is merged.

@codecov

codecov Bot commented Mar 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.63%. Comparing base (7d7fb78) to head (7bbdc41).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #12526      +/-   ##
============================================
- Coverage     21.64%   21.63%   -0.01%     
- Complexity     9861     9866       +5     
============================================
  Files           268      268              
  Lines         36920    36933      +13     
  Branches        495      495              
============================================
  Hits           7990     7990              
- Misses        28439    28452      +13     
  Partials        491      491              
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.01% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.69% <0.00%> (-0.01%) ⬇️
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

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.

@jndlansh

jndlansh commented Mar 4, 2026

Copy link
Copy Markdown
Contributor Author

Hi @JManion32 !

I have updated the "related to" - "closes" in the PR description.

Yes there is a UI change, I have added a checkbox (next to anonymous to class checkbox) that makes sure that reply to a pinned thread can be send as an announcement.

Before:
Screenshot 2026-03-04 172543

Now :
Screenshot 2026-03-04 175124
Screenshot 2026-03-04 175738

I have also tested the CI checks in my fork;
Screenshot 2026-03-04 184556

@jndlansh

jndlansh commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

@JManion32 could you please review my PR?

@roye2
roye2 self-requested a review March 13, 2026 02:25
@roye2 roye2 self-assigned this Mar 13, 2026
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to In Review in Submitty Development Mar 13, 2026

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

In my configuration (Linux + Firefox), when you click on the button to notify students, the browser confirmation popup appears multiple (5?) times even when you say yes for the first one. I am not sure why this is happening. I did test in Chrome and received the same issue.

Also, the button still does not explicitly say it will email the students with the notification. If email is enabled, it should say "Notify students (w/ email) (pinned thread reply)", as you stated previously in your PR, instead of just "Notify students (pinned thread reply)". This might mean that there is something wrong with the check on line 196 of ThreadPostForm.twig.

Otherwise, the changes of the code make sense to me and the feature seems to work as intended. I was able to verify that both the notifications and emails were sent correctly.

@github-project-automation github-project-automation Bot moved this from In Review to Work in Progress in Submitty Development Mar 13, 2026
@JManion32

JManion32 commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

@jndlansh please include those screenshots in the PR description.

@jndlansh

Copy link
Copy Markdown
Contributor Author

@jndlansh please include those screenshots in the PR description.

Yes @JManion32, I have edited the PR description with the screenshots.

@jndlansh
jndlansh requested a review from roye2 March 22, 2026 18:38
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Mar 22, 2026
@JManion32

Copy link
Copy Markdown
Contributor

@jndlansh What's the status of this PR? It seems that you haven't addressed the changes requested by @roye2.

@jndlansh

Copy link
Copy Markdown
Contributor Author

Hey @roye2 @JManion32 !

I have fixed the issues raised by @roye2 :

Multiple Popups : Now a single pop-up.

The old code accidentally attached multiple "click triggers" to the checkbox behind the scenes. When you clicked it once, all the hidden triggers fired at the same time.
Hence hardcoded onchange directly into the HTML means the checkbox can physically only hold one trigger.

The Missing (w/email) Text :

Updated the data array in ForumThreadView.php to explicitly pass $this->core->getConfig()->isEmailEnabled() down to the Twig templates. The (w/email) label now correctly conditionally renders based on the server's global email configuration.

Screenshot 2026-03-23 193733

Question : I want to ask, We tie this label (w/email) to the global server config rather than the thread's creation state to act as a safety warning, right? Since replying to any pinned thread automatically fires an email (if the server allows it), the UI needs to explicitly warn the user based on that global capability so they don't accidentally spam the class?

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

I tested the updated functionality and found that the popup only displayed once and the wording next to the checkbox was updated correctly. Once you fix the linting error shown in the CI (extra instance of "email-enabled") I can approve this PR.

P.S. Sorry for the delay in my review!

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

I tested the functionality and it appears to work as intended. I also reviewed the code, and I just left a comment about some specific lines that I thought could be extraneous.

"thread_announced" => $thread->isAnnounced(),
"show_reply_announcement" => $thread->isPinned() && $user->accessFullGrading() && $first,
"email_enabled" => $this->core->getConfig()->isEmailEnabled(),
"debug_thread_id" => $thread->getId(),

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.

Are the debug_<...> lines here something you used for debugging that can be removed? Or does it actually serve a purpose in the functionality.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, they have served their purpose in debugging, now removed.

@github-project-automation github-project-automation Bot moved this from In Review to Work in Progress in Submitty Development Apr 3, 2026
@jndlansh

jndlansh commented Apr 4, 2026

Copy link
Copy Markdown
Contributor Author

Yes these lines were added by me for temporary debugging and to to check if the correct thread or post was being processed. Thank you for pointing out, my bad!
I have removed those lines.

@jndlansh
jndlansh requested a review from roye2 April 4, 2026 11:25
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Apr 4, 2026

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

Okay, I've reviewed the code and the functionality. As far as I am concerned, everything looks good. Thanks for removing those extra bits.

@github-project-automation github-project-automation Bot moved this from In Review to Awaiting Maintainer Review in Submitty Development Apr 7, 2026
@jndlansh

jndlansh commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Okay, I've reviewed the code and the functionality. As far as I am concerned, everything looks good. Thanks for removing those extra bits.

Thank you @roye2 !

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

Overall, the feature looks good, I just found some small code changes to make. @jndlansh and @roye2 did either of you verify that both email types (thread announcement and announcement reply) are as expected? If possible, provide screenshots of the outputs.

Comment thread site/app/controllers/forum/ForumController.php Outdated
Comment thread site/app/controllers/forum/ForumController.php Outdated
Comment thread site/app/views/forum/ForumThreadView.php
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Work in Progress in Submitty Development May 1, 2026
@github-actions github-actions Bot added the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label May 16, 2026
@JManion32 JManion32 removed the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label May 25, 2026
@JManion32

Copy link
Copy Markdown
Contributor

@jndlansh Please address these small changes so that I can rereview. Thank you!

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

Code changes and functionality work as expected. Replies to PINNED threads by an instructor can be marked as an announcement. Note: you cannot make an announcement on a thread that is not pinned.

Comment thread site/app/views/forum/ForumThreadView.php
@github-project-automation github-project-automation Bot moved this from Work in Progress to Awaiting Maintainer Review in Submitty Development Jun 6, 2026
@bmcutler

bmcutler commented Jun 8, 2026

Copy link
Copy Markdown
Member

@jndlansh Please fix merge conflict

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

Cypress tests are now passing. There is a failing forum test, but this is on every branch currently.

@bmcutler
bmcutler merged commit 0f9ff50 into Submitty:main Jun 15, 2026
24 of 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.

Allow reply posts to be sent as announcements

4 participants