Group invite modal errors that share a message

What does this MR do and why?

When several invited members fail for the same reason, the invite members modal renders one identical error line per member (N members failing the same way = N copies of the same sentence). The expand/collapse added in Add expand/collapse when invite modal errors are more than 2 (!94199) only hides rows; the redundancy remains. This MR groups the error list by message, so each distinct failure renders once with the affected members named: email@example.com and root: <message>.

Per-member information is preserved: a member whose combined message differs from everyone else's still gets their own line, which keeps the "see everything wrong with one invitee at a glance" property the original design chose. Members are joined with the localized toNounSeriesText series helper. Titles keep counting members, not lines.

The same duplicated error-list pattern exists in the import-project-members modal, so the grouping lives in a shared helper (groupErrorsByMessage in invite_members/utils/member_utils.js) and both modals use it:

Consumer Change
invite_members_modal.vue grouped list, names via token lookup
import_project_members_modal.vue grouped list, names as @username

The expand/collapse behavior is unchanged and now operates on distinct messages: it appears when there are more than two grouped entries.

References

Screenshots or screen recordings

Before After
invite_errors_grouped invite_errors_grouped

How to set up and validate locally

  1. On a group or project members page, select Invite members.
  2. Invite two or more users who will fail the same way (for example, two emails from a domain blocked under Admin area > Settings > Sign-up restrictions, or re-invite existing members by email).
  3. Submit: the alert shows one line naming both members instead of two identical lines.
  4. Repeat with members failing for different reasons: each distinct message keeps its own line, and Show more appears past two lines.

Tests

  • spec/frontend/invite_members/utils/member_utils_spec.js: grouping, ordering, series text, unnamed members.
  • spec/frontend/invite_members/components/invite_members_modal_spec.js: grouped rendering for shared messages, member-count titles, collapse on distinct messages, clearing single members out of a group.
  • spec/frontend/invite_members/components/import_project_members_modal_spec.js: grouped rendering including the all-identical case, collapse with distinct messages.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Paul W

Merge request reports

Loading
Loading