Skip to content

Bug 2085141 - Make it more obvious when @mention is going to needinfo someone - #2811

Open
dklawren wants to merge 5 commits into
mozilla:masterfrom
dklawren:2085141
Open

dklawren wants to merge 5 commits into
mozilla:masterfrom
dklawren:2085141

Conversation

@dklawren

@dklawren dklawren commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Adds a live aria-live notice under the comment box listing who the comment will needinfo, and who will only be CC'd, visible in both Edit and Preview. Backed by POST /rest/needinfo/mentions, which shares the save-time mention rules, so the notice matches what saving does. Replaces the in-preview mention notice.

… someone

Adds a live aria-live notice under the comment box listing who the comment will needinfo, and who will only be CC'd, visible in both Edit and
  Preview. Backed by POST /rest/needinfo/mentions, which shares the save-time mention rules, so the notice matches what saving does. Replaces the in-preview mention notice.

Copilot AI 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.

🟡 Changes recommended

Notification predictions diverge from save behavior for new bugs, non-multiplicable needinfo flags, and restricted flag permissions, promising notifications or requests that will not occur.

3 open issues
What changed in this PR

This PR replaces the preview-only @mention notice with a live comment-editor warning that distinguishes needinfo recipients from CC-only recipients.

Changes:

  • Adds a debounced, accessible warning visible in both Edit and Preview.
  • Introduces POST /rest/needinfo/mentions and shares mention eligibility helpers with save-time processing.
  • Adds endpoint and unit coverage for mention predictions.
File Description
template/​en/​default/​global/​text-editor-include.html.tmpl Adds separate needinfo and CC-only labels.
skins/​standard/​text-editor.css Styles the live mention warning.
qa/​t/​rest_needinfo_mentions.t Adds REST endpoint tests.
js/​text-editor.js Replaces the preview notice with live mention checks.
extensions/​Needinfo/​template/​en/​default/​hook/​global/​header-start.html.tmpl Exposes the mention feature setting to the editor.
extensions/​Needinfo/​t/​mentions.t Tests recipient classification and new-bug predictions.
extensions/​Needinfo/​lib/​API/​V1/​Mentions.pm Implements the mention prediction endpoint.
extensions/​Needinfo/​Extension.pm Refactors shared eligibility logic and calculates mention effects.
Bugzilla/​API/​V1/​BugComment.pm Updates a comment to describe the live-warning endpoint.

Review effort: Balanced

Comment thread extensions/Needinfo/Extension.pm Resolved
Comment thread extensions/Needinfo/Extension.pm Resolved
Comment thread extensions/Needinfo/Extension.pm Resolved

Copilot AI 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.

🟡 Changes recommended

The recipient warning can misrepresent saved CC and needinfo outcomes because it ignores pending request changes, product-edit restrictions, and inactive flag types.

3 open issues
3 resolved since last review

Review effort: Balanced

Comment thread extensions/Needinfo/Extension.pm Resolved
Comment thread extensions/Needinfo/Extension.pm Resolved
Comment thread js/text-editor.js Resolved
… warning

- Treat an inactive needinfo type as CC-only, since core won't add new
  flags of an inactive type.
- With strict_isolation on, skip mentioned users who can't edit the
  product (add_cc would reject them) in the shared mention filter, so the
  warning neither lists them nor gives them a non-multiplicable needinfo
  slot.

Copilot AI 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.

🔵 Needs a closer look

Programmatically clearing an attachment comment does not emit an input event, leaving a stale needinfo warning visible and pending mention requests valid after switching attachments.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Clear stale needinfo warnings when switching attachments

js/​text-editor.js:822

The attachment overlay clears its comment using $form.comment.value = '' in extensions/BugModal/web/attachments_overlay.js:718, without emitting input or resetting the form. After entering a mention and switching attachments, none of these listeners runs, so the discarded comment's needinfo warning remains visible under the empty editor until another change triggers a check. Dispatch a native input event from that programmatic reset path so the warning is cleared and pending mention requests are invalidated.

3 resolved since last review

Review effort: Balanced

…leared by script

Setting a textarea's value doesn't fire an input event, so the live
@mention warning stayed visible (and a pending check could still show it)
after the attachment overlay cleared its comment on switching attachments,
and after an instant update cleared the main comment box. Dispatch an
input event in both places, as bug_modal.js already does when it restores
a saved comment.
@dklawren
dklawren requested review from Xzzz and cgsheeh November 4, 2026 22:18
# Saving a new bug doesn't process the mentions in its initial comment yet
# (bug 2087012), so predict nothing rather than promise notifications that
# won't be sent. Once it does, return new_bug_mention_effects here.
my $bug = $target->{bug} or return [];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This depends on #2809: once it lands, a new bug's description does needinfo, but this still returns [], so the entry form shows no warning (=> the clone case Connor raised there). Whichever PR merges second should switch this to new_bug_mention_effects. Until then, getMentionParams() could skip the new-bug branch, since the request always returns an empty list.

@Xzzz Xzzz left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks! One comment above, which depends on #2809.

This branch has not been deployed

No deployments
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.

3 participants