Skip to content

WIP: Expand InternalID to optionally carry a runtime-generated slug, see #28795

What does this MR do?

Show the title of models that have a InternalID in the url.

  • Works for Issues, Merge Requests, and Milestones.
  • Slugs are always lowercase and can only contain a-z, 0-9, and -.
  • The slug is generated at runtime when the owning model has a :title attr; it is not stored on the model.
  • The slug generation is in InternalId#make_iid_slug, as the two are closely linked.

Still missing:

  • No link rel=canonical.
  • The url in the browser is not updated with replaceState yet when coming from other places with a old/different slug.
  • No specs yet, as specs don't go through to_param so they never see the slug, as far as I can tell. Should this be changed?

Possibly room for improvement:

  • The route constraint RX could maybe be moved elsewhere?
  • The model scope/finder (where: iid) still works even with sluggified IIDs because to_i just truncates after the -. I think this is fine?
  • Also, better slug pattern?

Are there points in the code the reviewer needs to double check?

Ah, all of them! I'd like to bounce off for feedback and then work the rest out.

Why was this MR needed?

Feature request in #28795 (moved)

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #28795 (moved)

Merge request reports