block channels in trending too

This commit is contained in:
Bnyro 2022-08-27 16:44:01 +02:00
parent b46555fbcd
commit 4876ead6a3
5 changed files with 11 additions and 7 deletions

View file

@ -286,7 +286,7 @@
</div> </div>
<br /> <br />
</div> </div>
<h2 class="text-center" v-t="'actions.blocked_channels'"></h2> <h2 class="text-center" v-t="'titles.misc'"></h2>
<label class="pref" for="blockedChannels"> <label class="pref" for="blockedChannels">
<strong v-t="'actions.blocked_channels'" /> <strong v-t="'actions.blocked_channels'" />
<input <input

View file

@ -143,9 +143,9 @@ export default {
isBlocked(result) { isBlocked(result) {
if (!result.uploaderUrl) { if (!result.uploaderUrl) {
// item is a channel // item is a channel
return this.isChannelBlocked(result.url.replace("/channel/", "")); return this.isChannelBlocked(result.url);
} }
return this.isChannelBlocked(result.uploaderUrl.replace("/channel/", "")); return this.isChannelBlocked(result.uploaderUrl);
}, },
}, },
}; };

View file

@ -1,5 +1,5 @@
<template> <template>
<div> <div v-if="!isBlocked">
<router-link <router-link
:to="{ :to="{
path: '/watch', path: '/watch',
@ -178,6 +178,9 @@ export default {
short() { short() {
return this.video.duration > 0 && this.video.duration <= 61; return this.video.duration > 0 && this.video.duration <= 61;
}, },
isBlocked() {
return this.isChannelBlocked(this.video.uploaderUrl);
},
}, },
components: { PlaylistAddModal }, components: { PlaylistAddModal },
}; };

View file

@ -10,7 +10,8 @@
"playlists": "Playlists", "playlists": "Playlists",
"account": "Account", "account": "Account",
"instance": "Instance", "instance": "Instance",
"player": "Player" "player": "Player",
"misc": "Miscellaneous"
}, },
"player": { "player": {
"watch_on": "Watch on {0}" "watch_on": "Watch on {0}"
@ -98,7 +99,7 @@
"backup_preferences": "Backup preferences", "backup_preferences": "Backup preferences",
"restore_preferences": "Restore preferences", "restore_preferences": "Restore preferences",
"back_to_home": "Back to home", "back_to_home": "Back to home",
"blocked_channels": "Blocked channels" "blocked_channels": "Blocked channels (IDs, seperated by ',')"
}, },
"comment": { "comment": {
"pinned_by": "Pinned by", "pinned_by": "Pinned by",

View file

@ -234,7 +234,7 @@ const mixin = {
isChannelBlocked(channelId) { isChannelBlocked(channelId) {
const blockedChannels = localStorage.getItem("blockedChannels"); const blockedChannels = localStorage.getItem("blockedChannels");
if (!blockedChannels) return false; if (!blockedChannels) return false;
return blockedChannels.split(",").includes(channelId); return blockedChannels.split(",").includes(channelId.replace("/channel/", ""));
}, },
}, },
computed: { computed: {