Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hide channel option directly to More Options menu #4228

Conversation

MitchelPaulin
Copy link
Contributor

@MitchelPaulin MitchelPaulin commented Oct 24, 2023

Add hide channel option directly to More Options menu

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

closes #3051
closes #4037

Description

Piggybacks off the feature that was implemented in #2849 to add an option directly to the "More Options" menu to hide a channel. Options will show up in the "Distraction Settings" afterwards and can be removed from there.

Screenshots

Hide if not hidden

image

Show if hidden

image

Testing

Selected the option in the context menu, the video is immediately filtered and a toast is thrown up to confirm it was hidden. Then I checked the "Distraction Settings" and confirmed the channel is there.

Desktop

  • OS: Pop_OS
  • OS Version: 22.04 LTS
  • FreeTube version: 0.19.1

Additional Info

I decided not to go with "Hide Recommendation" like mentioned in the original issue as there really isn't recommendations, just trending.

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 24, 2023 23:45
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Oct 24, 2023
@PikachuEXE
Copy link
Collaborator

I think the new option should be added to the end with a separator
Also it might be better to add a confirmation modal/something to avoid misclick

@kommunarr
Copy link
Collaborator

Good work @MitchelPaulin!

On top of @PikachuEXE's suggestions, could you also add an "Unhide Channel" option for when the channel is hidden? That may sound silly, but hidden channel videos can still show up in other places like Subscriptions, the Channel page, and Playlists.

auto-merge was automatically disabled October 25, 2023 04:15

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 25, 2023 04:15
@MitchelPaulin
Copy link
Contributor Author

Moved it into its own divider at the bottom and added the ability to show hidden channels, good suggestions.

Not sure how I feel about the confirmation popup, I feel like it might just get in the way more than anything. But if its a blocker I can add it.

auto-merge was automatically disabled October 25, 2023 04:51

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 25, 2023 04:51
auto-merge was automatically disabled October 25, 2023 13:39

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 25, 2023 13:39
auto-merge was automatically disabled October 26, 2023 15:21

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 26, 2023 15:22
@kommunarr
Copy link
Collaborator

I don't think it's strictly needed because you can always see and remove those channels from your Distraction Free Settings. Especially given that there's a toast letting you know what you did if you accidentally clicked it. @PikachuEXE Second thoughts?

PikachuEXE
PikachuEXE previously approved these changes Oct 26, 2023
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm? Forgot to approve after review

Comment on lines 647 to 653
hideChannel: function(channelName) {
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
hiddenChannels.push(channelName)
this.updateChannelsHidden(JSON.stringify(hiddenChannels))

showToast(this.$t('Channel Hidden', { channel: channelName }))
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this pull request to use the channel ID, not the name. Blocking by name is unreliable as the channel owner can change the channel name, so you would have to block it again when that happens, but the ID never changes, so it will continue to work even when the name changes.

Copy link
Contributor Author

@MitchelPaulin MitchelPaulin Oct 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with the name since the Ids were very unreadable, if #4230 merges though that's no longer a concern, I can switch it to Ids

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Oct 28, 2023
auto-merge was automatically disabled October 28, 2023 19:07

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 28, 2023 19:08
}
)

const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
const channelShouldBeHidden = hiddenChannels.some(c => c === this.channelName || c === this.channelId)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK channelName is not a thing anymore

Copy link
Contributor Author

@MitchelPaulin MitchelPaulin Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we not need the channel name checked here to support anyone that has existing legacy blocks via channel name? Or were they all migrated to reference the channel Id?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i could be missing something but

If im looking at the conversations in #4230 i think everything is based on channel ID now

it was also mentioned that we should change this PR to channel ID only when that one was merged #4230 (comment)

Copy link
Contributor Author

@MitchelPaulin MitchelPaulin Nov 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just thinking of what would happen to a user who has blocked a channel by name then updates freetube, You can no longer make new blocks by channel name but even in #4230 to me it looks like existing channel name blocks are still respected https://github.com/Benjababe/FreeTube/blob/7272fc478c9c8a5d6a17f54660a1e93ba20ca943/src/renderer/components/ft-list-video-lazy/ft-list-video-lazy.js#L72

Or is it understood that updating freetube means your existing settings might no longer work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, scrolling through the other PR it does look like we are fine just not respecting legacy blocks #4230 (comment)

In that case I can remove the channel name check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the latest nightly this isnt a thing

auto-merge was automatically disabled November 18, 2023 14:56

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) November 18, 2023 14:56
@efb4f5ff-1298-471a-8973-3d47447115dc

I see channelName being used in more places do they also need to be removed?

auto-merge was automatically disabled November 18, 2023 15:47

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) November 18, 2023 15:48
@MitchelPaulin
Copy link
Contributor Author

I see channelName being used in more places do they also need to be removed?

Yes, missed a spot, the rest of the uses are for the toast message though, so those need to stay

@kommunarr
Copy link
Collaborator

Getting this issue on npm run dev:

    position: 39813,
    line: 924,
    column: 26,
    snippet: ` 922 | Downloading failed: 'There was an issue downloading "{vid ...\n` +
      ' 923 | Screenshot Success: Saved screenshot as "{filePath}"\n' +
      ' 924 | Screenshot Error: Screenshot failed. {error}\n' +
      ' 925 | Channel Hidden: {channel} added to channel filter\n' +
      '---------------------------------^\n' +
      ' 926 | Channel Unhidden: {channel} removed from channel filter\n' +
      ' 927 | '

@absidue
Copy link
Member

absidue commented Nov 20, 2023

Looks like an error caused by invalid YAML. The newly added strings with the curly bracket at the start probably need to be quoted.

auto-merge was automatically disabled November 20, 2023 20:38

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) November 20, 2023 20:38
@absidue
Copy link
Member

absidue commented Nov 20, 2023

Thank you for your contribution! sorry for the long back-and-forwards on this.

Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested after merging development into this branch otherwise it might not work properly
All seems fine

@FreeTubeBot FreeTubeBot merged commit 86bad25 into FreeTubeApp:development Nov 21, 2023
6 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 21, 2023
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Nov 21, 2023
* development:
  Update to silently allow channel links (with IDs) (FreeTubeApp#4347)
  Add hide channel option directly to More Options menu (FreeTubeApp#4228)
  Translated using Weblate (Chinese (Simplified))
  Translated using Weblate (Spanish)
  Make landing page configurable (FreeTubeApp#4200)
  Bump @silvermine/videojs-quality-selector from 1.3.0 to 1.3.1 (FreeTubeApp#4362)
  Bump electron from 27.0.4 to 27.1.0 (FreeTubeApp#4363)
  Bump the eslint group with 1 update (FreeTubeApp#4360)
  Bump actions/github-script from 6 to 7 (FreeTubeApp#4361)
  add image to poll & updated quiz style (FreeTubeApp#4318)
  Move hideOutlines to the utils store instead of using provide/inject (FreeTubeApp#4246)
  Translated using Weblate (Kurdish (Central))
  Translated using Weblate (English (United Kingdom))
  Translated using Weblate (French)
  Translated using Weblate (German)
  Added translation using Weblate (Kurdish (Central))
  Translated using Weblate (Slovak)

# Conflicts:
#	src/renderer/components/ft-list-video/ft-list-video.js
@BarbzYHOOL

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants