Merge pull request #1232 from Bnyro/mobile

show comments as disabled by user if disabled in settings
This commit is contained in:
Kavin 2022-07-20 23:59:50 +05:30 committed by GitHub
commit 9c0f4e2d24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -158,11 +158,14 @@
<hr /> <hr />
<div class="grid xl:grid-cols-5 sm:grid-cols-4 grid-cols-1"> <div class="grid xl:grid-cols-5 sm:grid-cols-4 grid-cols-1">
<div v-if="!comments" class="xl:col-span-4 sm:col-span-3"> <div v-if="!commentsEnabled" class="xl:col-span-4 sm:col-span-3">
<p class="text-center mt-8">Comments are loading...</p> <p class="text-center mt-8" v-t="'comment.user_disabled'"></p>
</div>
<div v-else-if="!comments" class="xl:col-span-4 sm:col-span-3">
<p class="text-center mt-8" v-t="'comment.loading'"></p>
</div> </div>
<div v-else-if="comments.disabled" class="xl:col-span-4 sm:col-span-3"> <div v-else-if="comments.disabled" class="xl:col-span-4 sm:col-span-3">
<p class="text-center mt-8">Comments are turned off.</p> <p class="text-center mt-8" v-t="'comment.disabled'"></p>
</div> </div>
<div v-else ref="comments" class="xl:col-span-4 sm:col-span-3"> <div v-else ref="comments" class="xl:col-span-4 sm:col-span-3">
<CommentItem <CommentItem
@ -266,6 +269,9 @@ export default {
year: "numeric", year: "numeric",
}); });
}, },
commentsEnabled() {
return this.getPreferenceBoolean("comments", true);
},
}, },
mounted() { mounted() {
// check screen size // check screen size
@ -313,7 +319,7 @@ export default {
this.index = Number(this.$route.query.index); this.index = Number(this.$route.query.index);
this.getPlaylistData(); this.getPlaylistData();
this.getSponsors(); this.getSponsors();
if (!this.isEmbed && this.getPreferenceBoolean("comments", true)) this.getComments(); if (!this.isEmbed && this.commentsEnabled) this.getComments();
window.addEventListener("resize", () => { window.addEventListener("resize", () => {
this.smallView = this.smallViewQuery.matches; this.smallView = this.smallViewQuery.matches;
}); });

View File

@ -86,7 +86,10 @@
"minimize_recommendations_default": "Minimize Recommendations by default" "minimize_recommendations_default": "Minimize Recommendations by default"
}, },
"comment": { "comment": {
"pinned_by": "Pinned by" "pinned_by": "Pinned by",
"disabled": "Comments are disabled by the uploader.",
"loading": "Comments are loading ...",
"user_disabled": "Comments are disabled in the settings."
}, },
"preferences": { "preferences": {
"instance_name": "Instance Name", "instance_name": "Instance Name",