Skip to content

Apply auto-linking after unfolding diffs #2091

Closed

Description

@wearhere

This is a follow-up from #1499. Of the repro cases I provided there

URLs appear to not be linked even if the URL as a whole was added (first example), or even if they're just in comments alongside changes (second example—note that I unfolded the top of the diff to get there, not sure if that matters).

URLs do appear to be linked if they're in non-PR code blocks (third example).

The first is fixed with #2066, and the third remains fixed, but the second is still broken.

I can repro both if I visit the unfolded part directly (link) and if I go to the folded diff (link), then unfold the top (one unfold should be sufficient to see the link, at line 51).

Not sure if this is a regression or no.

Activity

  1. changed the title [-]Auto-linking is not correctly applied to links in *unfolded* diffs[/-] [+]Apply auto-linking after unfolding diffs[/+] on May 28, 2019
  2. fregante commented on May 28, 2019

    @fregante
    Member

    Yeah this was never supported, it would be good to support it if there's a simple event to listen to. The same goes for all other features that work on diffs/code

  3. wearhere commented on May 28, 2019

    @wearhere
    Author

    it would be good to support it if there's a simple event to listen to

    You mean like an event for more code becoming visible on-screen? Hm… I don't know what kind of events you might be thinking of. I guess my first approach would be to detect clicks on the fold/unfold buttons and re-run any diff-processing logic after that. Probably also good to do the same after the user clicks the "this diff is too long, click to expand" button for default-collapsed files.

  4. fregante commented on May 29, 2019

    @fregante
    Member

    GitHub fires their own events, like “load” and whatnot. Someone needs to find out by looking into their code (using dom breakpoints in chrome)

  5. fregante commented on May 29, 2019

    @fregante
    Member

    Indeed!

  6. fregante commented on Aug 13, 2019

    @fregante
    Member

    @notlmn we missed that part at some point I guess. The link in this code is not auto-linked:

    example

  7. notlmn commented on Sep 12, 2019

    @notlmn
    Contributor

    I thought that #2073 would fix this, but that wouldn't as on-pr-file-load was about handling events from entire file diffs being ajaxed. This issue requires us to listen on clicks in the "diff expander" links being clicked on and run linkify-code to be run again.

    But that might not be enough, as linkify-code adds .rgh-linkified-code class to the entire file diff element, that might prevent us from running linkify-code on the same file diff again, which might linkify already linkified code blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions