From 1d7c9e17feaed3805bb1881d9776d7306cc85611 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 2 Jan 2025 22:47:53 +0200 Subject: [PATCH 1/7] update vue-i18n, simplify logic of muting, always show reasons for mutes, fix RT icon --- package.json | 2 +- src/components/status/status.js | 49 ++++++++++++++++----- src/components/status/status.scss | 21 +-------- src/components/status/status.vue | 44 ++++--------------- src/i18n/en.json | 2 + yarn.lock | 73 +++++++++++++------------------ 6 files changed, 83 insertions(+), 108 deletions(-) diff --git a/package.json b/package.json index fa08593f0..182a541d9 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "url": "0.11.0", "utf8": "3.0.0", "vue": "3.2.45", - "vue-i18n": "9.2.2", + "vue-i18n": "10", "vue-router": "4.1.6", "vue-template-compiler": "2.7.14", "vue-virtual-scroller": "^2.0.0-beta.7", diff --git a/src/components/status/status.js b/src/components/status/status.js index 1a7101622..41275a5be 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -260,18 +260,47 @@ const Status = { hasMentionsLine () { return this.mentionsLine.length > 0 }, + muteReasons () { + return [ + this.userIsMuted ? 'user' : null, + status.thread_muted ? 'thread' : null, + (this.muteWordHits.length > 0) ? 'wordfilter' : null, + (this.muteBotStatuses && this.botStatus) ? 'bot' : null, + (this.muteSensitiveStatuses && this.sensitiveStatus) ? 'nsfw' : null + ].filter(_ => _) + }, + muteLocalized () { + if (this.muteReasons.length === 0) return null + const mainReason = () => { + switch (this.muteReasons[0]) { + case 'user': return this.$t('status.muted_user') + case 'thread': return this.$t('status.thread_muted') + case 'wordfilter': + return this.$t( + 'status.muted_words', + { + word: this.muteWordHits[0], + numWordsMore: this.muteWordHits.length - 1 + }, + this.muteWordHits.length + ) + case 'bot': return this.$t('status.bot_muted') + case 'nsfw': return this.$t('status.sensitive_muted') + } + } + console.log(this.muteReasons, mainReason()) + return this.$t( + 'status.multi_reason_mute', + { + main: mainReason(), + numReasonsMore: this.muteReasons.length - 1 + }, + this.muteReasons.length - 1 + ) + }, muted () { if (this.statusoid.user.id === this.currentUser.id) return false - const reasonsToMute = this.userIsMuted || - // Thread is muted - status.thread_muted || - // Wordfiltered - this.muteWordHits.length > 0 || - // bot status - (this.muteBotStatuses && this.botStatus && !this.compact) || - // sensitive status - (this.muteSensitiveStatuses && this.sensitiveStatus && !this.compact) - return !this.unmuted && !this.shouldNotMute && reasonsToMute + return !this.unmuted && !this.shouldNotMute && this.muteReasons.length > 0 }, userIsMuted () { if (this.statusoid.user.id === this.currentUser.id) return false diff --git a/src/components/status/status.scss b/src/components/status/status.scss index 85ad24b31..97f0050df 100644 --- a/src/components/status/status.scss +++ b/src/components/status/status.scss @@ -284,15 +284,10 @@ gap: 1ex; & .status-username, - & .mute-thread, - & .mute-words { + & .mute-reason { word-wrap: normal; word-break: normal; white-space: nowrap; - } - - & .status-username, - & .mute-words { text-overflow: ellipsis; overflow: hidden; } @@ -302,19 +297,7 @@ flex: 0 1 auto; margin-right: 0.2em; font-size: smaller; - } - - .mute-thread { - flex: 0 0 auto; - } - - .mute-words { - flex: 1 0 5em; - margin-left: 0.2em; - - &::before { - content: " "; - } + display: flex; } .unmute { diff --git a/src/components/status/status.vue b/src/components/status/status.vue index f3935c483..be286191c 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -30,36 +30,8 @@ :at="false" /> - - {{ $t('status.sensitive_muted') }} - - - {{ $t('status.bot_muted') }} - - - - {{ $t('status.thread_muted') }} - - - {{ $t('status.thread_muted_and_words') }} - - - - {{ muteWordHits.join(', ') }} + + {{ muteLocalized }} @@ -108,7 +108,7 @@ From 32d07606ba0c97aed8250f62fb9c0a5e1b65edea Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 2 Jan 2025 23:02:11 +0200 Subject: [PATCH 3/7] changelog --- changelog.d/mutes.change | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/mutes.change diff --git a/changelog.d/mutes.change b/changelog.d/mutes.change new file mode 100644 index 000000000..f55a8abbf --- /dev/null +++ b/changelog.d/mutes.change @@ -0,0 +1 @@ +better display of mutes From 41a1a75f7480b814b417e536e2ff5b5c8af3c16e Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 4 Jan 2025 01:39:20 +0200 Subject: [PATCH 4/7] another $tc --- src/components/timeago/timeago.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/timeago/timeago.vue b/src/components/timeago/timeago.vue index 484944d61..d0b86e7d4 100644 --- a/src/components/timeago/timeago.vue +++ b/src/components/timeago/timeago.vue @@ -40,7 +40,7 @@ export default { return this.timeAsDate.toLocaleString(this.browserLocale) }, relativeTimeString () { - const timeString = this.$i18n.tc(this.relativeTime.key, this.relativeTime.num, [this.relativeTime.num]) + const timeString = this.$i18n.t(this.relativeTime.key, [this.relativeTime.num], this.relativeTime.num) if (typeof this.templateKey === 'string' && this.relativeTime.key !== 'time.now') { return this.$i18n.t(this.templateKey, [timeString]) From ada054189dcef157e12b23ff476ae12c5a7960e4 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 4 Jan 2025 01:58:30 +0200 Subject: [PATCH 5/7] missing localization string --- src/i18n/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i18n/en.json b/src/i18n/en.json index 0839c0460..66ddb4139 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1407,6 +1407,7 @@ }, "tool_tip": { "media_upload": "Upload media", + "mentions": "Mentions", "repeat": "Repeat", "reply": "Reply", "favorite": "Favorite", From 338bdd93de3e6471c276306b9078e4d02040357d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 4 Jan 2025 02:04:16 +0200 Subject: [PATCH 6/7] how did this get in here?? --- src/components/status/status.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/status/status.vue b/src/components/status/status.vue index e95a899c6..c58178b3c 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -292,7 +292,7 @@ v-if="!isPreview" :status-id="status.parent_visible && status.in_reply_to_status_id" class="reply-to-popover" - style="min-width: 0" + style="min-width: 0;" :class="{ '-strikethrough': !status.parent_visible }" >