Skip to content

Linking objects from GFM references

Matthias Käppler requested to merge github/fork/smashwilson/linking-issues into master

Created by: smashwilson

Hello!

This is an implementation in progress of linking issues from comments, also referenced in #2676 (closed), #2714 (closed), #1170 (closed), #302 (closed), and probably others. I'm pushing it out now to get early feedback on what I've already done and to hear any thoughts about edge cases I might not be accounting for.

Any mention of issues, merge requests, or commits via GitLab-flavored markdown references in descriptions, titles or follow-on notes to any of the above attaches a system note to the referenced object containing a backtracking link. Furthermore, pushing commits that match a (configurable) regexp to a project's default branch will close any issues mentioned in the closing phrase.

Left to do:

  • Only close issues from commits pushed to the project's default branch -- meaning, actually make it do that thing I said it does 😉
  • If any Mentionable is edited, create additional cross-references for any references that weren't there to begin with.
  • Merge request and issue creation don't create cross-references correctly, only notes and edits. D'oh.
  • Accepting a merge request that brings in a commit that "fixes" an issue works fine, but if the "fixes" text is in a line other than the first, it happens without warning. Detect and add an "accepting this request will close issues X, Y, and Z" banner on the merge request page.
  • Look into using ActiveRecord::Dirty to implement Mentionable#watch_references, which would let us push reference updating into the observers where it belongs.
  • Duplicate "mentioned in commit..." notes when a commit that mentions a thing is merged into a new branch.
  • Link an issue closed notification back to the commit that closed it, when closing from a commit. "Status changed to closed by..."
  • Catch references in the commits in the first push to a new branch.
  • Do a final rebase and squash on upstream master.

Merge request reports

Loading