Don't allow duplicate resource links (by URL) in incidents

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Collaborate/take over this issue

In incidents, you can add duplicate resource links:

image

This doesn't seem very useful to allow, and could be confusing when the link text is different.

Implementation guide

  1. Return an error saying "URL already linked" in IncidentManagement::IssuableResourceLinks::Create
    • For this, we need to check if the incident already links a resource with the same link
      • For the sake of simplicity we are not normalizing URLs which means that these URLs are identical: https://example.org and https://example.org/ (note the trailing slash)
    • For example, incident.issuable_resource_links.where(link: params[:link]).exists?
    • Check if the existing index (index_issuable_resource_links_on_issue_id) is speedy
    • 🅰️ If not (due to too many linked resources per issue)
      • Consider a composite index on issue_id, link
      • Limit amount of resources per issue to 100. This would also have some positive implications on the UX. See splattael/mwps#21.
  2. 🅱️ Ensure that the service response's message is properly propagated to the user. Currently, we fail to say why saving a resource link is failing.
  • The locations are:
    • resource_link = ::IncidentManagement::IssuableResourceLinks::CreateService.new(quick_action_target,
    • IssuableResourceLinks::CreateService.new(@incident,
    • response ::IncidentManagement::IssuableResourceLinks::CreateService.new(incident, current_user, args).execute

Note that 🅰️ and 🅱️ could be separate MRs.

Additional guidance:

  • Here is how to add a linked resource to an incident
  • Note that Linked resources are available in GitLab Premium. Here's a handbook page on how you can get one
Edited Aug 19, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading