Skip to content

Update permalink/blame buttons with line number fragment hash

What does this MR do?

Updates permalink and blame buttons href to include the line number fragment hash.

Previous MR to add y keyboard shortcut that maintained line number fragment hash, https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8799

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

  • Are we ok with the app/assets/javascripts/extensions/history.js that fires off an event whenever history.pushState is called?
    • When clicking a line number, it changes the URL to #LX with history.pushState which doesn't have a way to listen to natively
    • Clicking a line number is preventDefault'ed and stopPropagation'ed so we can't hook on that and adding it directly in line_highter.js doesn't seem right.

Why was this MR needed?

Previously when you clicked a line number and had the #LX fragment hash and then click the Permalink or Blame button, it would get rid of the hash.

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

EE MR: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1381

What are the relevant issue numbers?

Closes #19742 (closed)

Merge request reports