FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

Fix URL copied via right click menu

Open PikachuEXE opened this issue 1 year ago • 5 comments

Pull Request Type

  • [x] Bugfix
  • [ ] Feature Implementation
  • [ ] Documentation
  • [ ] Other

Related issue

#4687

Includes code from #4687 so you can test that PR properly but not saying that PR can be merged already

Description

Fix URL copied via right click menu

Fixes:

  • Invalid URL when copying IV video
  • URL with user playlist ID
  • Playlist URL can be copied via right clicking on a user playlist link

Screenshots

Testing

  • Right click copy on a video with user playlist (Local & IV URL), ensure URL correct (no double question mark, nor playlist ID)
  • Right click copy on a video withremote playlist (Local & IV URL), ensure URL correct (no double question mark, with playlist ID)
  • Right click copy on a link with user playlist, ensure no entry for copying URL
  • Right click copy on a link withremote playlist (Local & IV URL), ensure URL correct
  • Test cases in #4687

Desktop

  • OS:
  • OS Version:
  • FreeTube version:

Additional context

PikachuEXE avatar Feb 19 '24 08:02 PikachuEXE

Could you please also hide the Copy Link options when right clicking on a user playlist on the user playlist page (see screenshot)? user-playlist-context-menu

Something like this should work:

          if (path) {
-            visible = ['/playlist', '/channel', '/watch'].some(p => path.startsWith(p))
+            visible = ['/channel', '/watch'].some(p => path.startsWith(p)) ||
+              (path.startsWith('/playlist') && !/[&?]playlistType=user(?:&|$)/.test(path))
          }

absidue avatar Feb 22 '24 18:02 absidue

Updated, added Playlist URL can be copied via right clicking on a user playlist link to desc about fixed items, added test cases

PikachuEXE avatar Feb 22 '24 23:02 PikachuEXE

Does this PR needs updating now that #4687 has been merged?

Why I can't rebase via UI here :( Me lazy

PikachuEXE avatar Feb 26 '24 11:02 PikachuEXE

Rebased, 2 commits left

PikachuEXE avatar Feb 27 '24 00:02 PikachuEXE