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

Added comments toggle in client settings #2739

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions client/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ const videoQualities = ['144p', '240p', '360p', '720p', '1080p', '1440p', '2160p
:right="true"
@valuechange="val => settingsStore.setRewriteYouTubeURLs(val)"
/>
<SwitchButton
:value="settingsStore.hideComments"
:label="'Hide comments'"
:small-label="'Do not load and do not show comments on videos'"
:disabled="false"
:right="true"
@valuechange="val => settingsStore.setHideComments(val)"
/>

<h2><VTIcon name="mdi:television" />Videoplayer</h2>
<div class="settings-dropdown-menu">
Expand Down
8 changes: 5 additions & 3 deletions client/pages/watch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ watch(
if (newValue.v !== oldValue.v || newValue.list !== oldValue.list) {
refresh();
const videoId = newValue.v as string;
loadComments(videoId);
if (!settingsStore.hideComments)
loadComments(videoId);
}
}
);
Expand All @@ -249,7 +250,8 @@ onMounted(() => {
if (window && window.innerWidth > 700) {
recommendedOpen.value = true;
}
loadComments();
if (!settingsStore.hideComments)
loadComments();
loadDislikes();
loadPlaylist();
});
Expand Down Expand Up @@ -426,7 +428,7 @@ const watchPageTitle = computed(() => {
</div>
</div>

<div class="comments-description">
<div v-if="!settingsStore.hideComments" class="comments-description">
<div
class="video-infobox-description links"
v-html="createTextLinks(video.description)"
Expand Down
1 change: 1 addition & 0 deletions client/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const useSettingsStore = defineStore(
const state = toRefs(
reactive({
alwaysLoopVideo: false,
hideComments: false,
audioModeDefault: false,
autoAdjustAudioQuality: true,
autoAdjustVideoQuality: true,
Expand Down
2 changes: 2 additions & 0 deletions server/src/user/settings/dto/settings.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export class SettingsDto {

alwaysLoopVideo: boolean;

hideComments: boolean;

autoplayNextVideo: boolean;

audioModeDefault: boolean;
Expand Down
3 changes: 3 additions & 0 deletions server/src/user/settings/schemas/settings.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export class Settings extends Document implements SettingsDto {
@Prop()
alwaysLoopVideo: boolean;

@Prop()
hideComments: boolean;

@Prop()
autoplayNextVideo: boolean;

Expand Down
1 change: 1 addition & 0 deletions server/src/user/settings/settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class SettingsService {

private defaultOptions: SettingsDto = {
alwaysLoopVideo: false,
hideComments: false,
audioModeDefault: false,
autoAdjustAudioQuality: true,
autoAdjustVideoQuality: true,
Expand Down
1 change: 1 addition & 0 deletions shared/api.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export interface components {
saveVideoHistory: boolean;
showHomeSubscriptions: boolean;
alwaysLoopVideo: boolean;
hideComments: boolean;
autoplayNextVideo: boolean;
audioModeDefault: boolean;
defaultVideoSpeed: number;
Expand Down
Loading