Skip to content

Prevent linkify-urls from running multiple times - #3516

Merged
fregante merged 2 commits into
refined-github:masterfrom
kidonng:linkify-code
Aug 29, 2020
Merged

fregante merged 2 commits into
refined-github:masterfrom
kidonng:linkify-code

Conversation

@kidonng

@kidonng kidonng commented Aug 28, 2020 •

Copy link
Copy Markdown
Member

Both .blob-wrapper and .comment-body matches a code block in review comments, so the linkify functions got run for multiple times.

  1. LINKED ISSUES:
    Fix linkify-code runs multiple times on the same URL #3226

  2. TEST URLS:
    Restore repo-age in "Repository refresh" beta #3225 (comment)

  3. SCREENSHOT:
    Before: image
    After:
    image

@fregante

Copy link
Copy Markdown
Member

I think we should limit the comment-body selector instead. It should only work on code (I think)

@kidonng

kidonng commented Aug 28, 2020 •

Copy link
Copy Markdown
Member Author

Do you mean it should only apply to standalone comments (i.e. not review comments)? The only difference is that the former has .d-block while the latter has .soft-wrap but I'm not sure if they are reliable enough

@fregante fregante added the bug label Aug 28, 2020
@fregante fregante changed the title Prevent linkify-urls from running multiple times on review comments Prevent linkify-urls from running multiple times Aug 29, 2020
@fregante
fregante merged commit e7bb8a6 into refined-github:master Aug 29, 2020
@fregante

fregante commented Aug 29, 2020 •

Copy link
Copy Markdown
Member

I think this feature needs to be slightly rewritten to avoid this duplicate select.all usage

Can you try picking up #3091? It should be better because:

  • it only affects visible code, also used in #2737
  • it selects the specific elements instead of "observe their parent + select.all inside"
  • it should also solve Apply auto-linking after unfolding diffs #2091, which was for linkify-code but also affects linkify-urls afaik

Anyway, thank you for the bugfix, still better than nothing waiting for #3091 :)

@kidonng
kidonng deleted the linkify-code branch September 9, 2020 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

linkify-code runs multiple times on the same URL

2 participants