Fix contacts warning when changing work item type
What does this MR do and why?
This MR fixes an issue where the Change type dialog incorrectly lists Contacts as information that will be lost when promoting an issue to an epic, even when the issue has no associated CRM contacts.
Previously, the dialog relied on contactsAvailable, which indicates group-level CRM contact availability rather than whether the current work item actually has associated contacts.
This MR:
- Fetches the work item's contacts on demand in the modal with the existing
workItemCrmContactsquery, using the same variables as the sidebar so Apollo can merge the requests. Contacts is listed as lost information only when the query returns at least one associated contact. - Skips the query when the work item has no CRM Contacts widget or when
contactsAvailableisfalse. - Leaves the shared
BaseWorkItemFeaturesGraphQL fragment unchanged, so the shared work item detail queries and mutations don't get more expensive. - Uses the
WIDGET_TYPE_CRM_CONTACTSconstant instead of a hard-coded string. - Adds frontend tests for the on-demand query with no contacts and with an associated contact, for both widget-based and feature-based data, and for the case where
contactsAvailableisfalse(no request, no warning). - Asserts that Contacts appears in the warning text only when the work item has associated contacts.
As a result, Contacts is listed as lost information only when the issue has at least one associated contact.
References
Closes #639070 (closed)
Related issue: #580580 (closed) (closed)
Screenshots or screen recordings
Change type → Epic (Promote to group) on an issue in a group with CRM contacts. Captured on a local GDK by @vanessaotto.
| Issue | Before | After |
|---|---|---|
| No contacts | ![]() |
![]() |
| One contact | ![]() |
![]() |
- No contacts: Contacts is no longer listed.
- One contact: Contacts is still listed.
How to set up and validate locally
- Use a GitLab development environment with the frontend dependencies installed.
- Create a group with at least one CRM contact.
- Create an issue in a project belonging to that group without associating any contacts.
- Open More actions → Change type and select Epic (Promote to group).
- Verify that Contacts is not listed in the information-loss warning.
- Associate one or more CRM contacts with the issue and repeat the steps.
- Verify that Contacts appears in the warning.
Frontend test coverage has been added in:
spec/frontend/work_items/components/work_item_change_type_modal_spec.js
Validated locally: the focused Jest specs (CE and EE) pass, and ESLint and Prettier pass. GraphQL ESLint could not be run locally because the Apollo schema was unavailable, so CI covers it.
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.
- Changes are scoped to the reported issue.
- Regression test coverage added for empty and single-contact scenarios.
- Both widget-based and feature-based data paths are covered.
- The shared
BaseWorkItemFeaturesfragment is unchanged. -
git diff --checkpasses. - Focused frontend Jest test passes locally.
- Focused frontend Jest test passes in CI.
- GraphQL and frontend CI checks pass.
Closes #639070 (closed)



