Don't allow duplicate resource links (by URL) in incidents
In incidents, you can add duplicate resource links:
This doesn't seem very useful to allow, and could be confusing when the link text is different.
Implementation guide
- 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 samelink
- For the sake of simplicity we are not normalizing URLs which means that these URLs are identical:
https://example.org
andhttps://example.org/
(note the trailing slash)
- For the sake of simplicity we are not normalizing URLs which means that these URLs are identical:
- 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.
- Consider a composite index on
- For this, we need to check if the
-
🅱 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:
Note that
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 by Peter Leitzen