logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/
commit: 1d7c9e17feaed3805bb1881d9776d7306cc85611
parent 2c520bdc4f1579a4ae69a0d85cf9b17fd22ae3b2
Author: Henry Jameson <me@hjkos.com>
Date:   Thu,  2 Jan 2025 22:47:53 +0200

update vue-i18n, simplify logic of muting, always show reasons for mutes, fix RT icon

Diffstat:

Mpackage.json2+-
Msrc/components/status/status.js49+++++++++++++++++++++++++++++++++++++++----------
Msrc/components/status/status.scss21++-------------------
Msrc/components/status/status.vue44+++++++++-----------------------------------
Msrc/i18n/en.json2++
Myarn.lock73++++++++++++++++++++++++++++++-------------------------------------------
6 files changed, 83 insertions(+), 108 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -30,36 +30,8 @@ :at="false" /> </small> - <small - v-if="muteSensitiveStatuses && status.nsfw" - class="mute-thread" - > - {{ $t('status.sensitive_muted') }} - </small> - <small - v-if="muteBotStatuses && botStatus" - class="mute-thread" - > - {{ $t('status.bot_muted') }} - </small> - <small - v-if="showReasonMutedThread" - class="mute-thread" - > - <span> - {{ $t('status.thread_muted') }} - </span> - <span - v-if="muteWordHits.length > 0" - > - {{ $t('status.thread_muted_and_words') }} - </span> - </small> - <small - class="mute-words" - :title="muteWordHits.join(', ')" - > - {{ muteWordHits.join(', ') }} + <small class="mute-reason"> + {{ muteLocalized }} </small> <button class="unmute button-unstyled" @@ -313,13 +285,14 @@ > <i18n-t keypath="status.reply_to_with_arg" + scope="global" > <template #replyToWithIcon> <StatusPopover 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 }" > <button @@ -327,7 +300,10 @@ :aria-label="$t('tool_tip.reply')" @click.prevent="gotoOriginal(status.in_reply_to_status_id)" > - <i18n-t keypath="status.reply_to_with_icon"> + <i18n-t + keypath="status.reply_to_with_icon" + scope="global" + > <template #icon> <FAIcon class="fa-scale-110 fa-old-padding" @@ -622,15 +598,13 @@ class="status-container reply-form" > <PostStatusForm - ref="postStatusForm" class="reply-body" :reply-to="status.id" :attentions="status.attentions" :replied-user="status.user" :copy-message-scope="status.visibility" :subject="replySubject" - @posted="doToggleReplying" - @can-close="doToggleReplying" + @posted="toggleReplying" /> </div> </template> diff --git a/src/i18n/en.json b/src/i18n/en.json @@ -1243,6 +1243,8 @@ "status_unavailable": "Status unavailable", "copy_link": "Copy link to status", "external_source": "External source", + "muted_words": "Wordfiltered: {word} | Wordfiltered: {word} and {numWordsMore} more word", + "multi_reason_mute": "{main} | {main} + one more reason | {main} + {numReasonsMore} more reasons", "thread_muted": "Thread muted", "thread_muted_and_words": ", has words:", "sensitive_muted": "Muting sensitive content", diff --git a/yarn.lock b/yarn.lock @@ -1804,30 +1804,21 @@ source-map "0.6.1" yaml-eslint-parser "^0.3.2" -"@intlify/core-base@9.2.2": - version "9.2.2" - resolved "https://registry.yarnpkg.com/@intlify/core-base/-/core-base-9.2.2.tgz#5353369b05cc9fe35cab95fe20afeb8a4481f939" - integrity sha512-JjUpQtNfn+joMbrXvpR4hTF8iJQ2sEFzzK3KIESOx+f+uwIjgw20igOyaIdhfsVVBCds8ZM64MoeNSx+PHQMkA== - dependencies: - "@intlify/devtools-if" "9.2.2" - "@intlify/message-compiler" "9.2.2" - "@intlify/shared" "9.2.2" - "@intlify/vue-devtools" "9.2.2" - -"@intlify/devtools-if@9.2.2": - version "9.2.2" - resolved "https://registry.yarnpkg.com/@intlify/devtools-if/-/devtools-if-9.2.2.tgz#b13d9ac4b4e2fe6d2e7daa556517a8061fe8bd39" - integrity sha512-4ttr/FNO29w+kBbU7HZ/U0Lzuh2cRDhP8UlWOtV9ERcjHzuyXVZmjyleESK6eVP60tGC9QtQW9yZE+JeRhDHkg== +"@intlify/core-base@10.0.5": + version "10.0.5" + resolved "https://registry.yarnpkg.com/@intlify/core-base/-/core-base-10.0.5.tgz#c4d992381f8c3a50c79faf67be3404b399c3be28" + integrity sha512-F3snDTQs0MdvnnyzTDTVkOYVAZOE/MHwRvF7mn7Jw1yuih4NrFYLNYIymGlLmq4HU2iIdzYsZ7f47bOcwY73XQ== dependencies: - "@intlify/shared" "9.2.2" + "@intlify/message-compiler" "10.0.5" + "@intlify/shared" "10.0.5" -"@intlify/message-compiler@9.2.2": - version "9.2.2" - resolved "https://registry.yarnpkg.com/@intlify/message-compiler/-/message-compiler-9.2.2.tgz#e42ab6939b8ae5b3d21faf6a44045667a18bba1c" - integrity sha512-IUrQW7byAKN2fMBe8z6sK6riG1pue95e5jfokn8hA5Q3Bqy4MBJ5lJAofUsawQJYHeoPJ7svMDyBaVJ4d0GTtA== +"@intlify/message-compiler@10.0.5": + version "10.0.5" + resolved "https://registry.yarnpkg.com/@intlify/message-compiler/-/message-compiler-10.0.5.tgz#4eeace9f4560020d5e5d77f32bed7755e71d8efd" + integrity sha512-6GT1BJ852gZ0gItNZN2krX5QAmea+cmdjMvsWohArAZ3GmHdnNANEcF9JjPXAMRtQ6Ux5E269ymamg/+WU6tQA== dependencies: - "@intlify/shared" "9.2.2" - source-map "0.6.1" + "@intlify/shared" "10.0.5" + source-map-js "^1.0.2" "@intlify/message-compiler@next": version "9.2.0-beta.34" @@ -1837,24 +1828,21 @@ "@intlify/shared" "9.2.0-beta.34" source-map "0.6.1" +"@intlify/shared@10.0.5": + version "10.0.5" + resolved "https://registry.yarnpkg.com/@intlify/shared/-/shared-10.0.5.tgz#1b46ca8b541f03508fe28da8f34e4bb85506d6bc" + integrity sha512-bmsP4L2HqBF6i6uaMqJMcFBONVjKt+siGluRq4Ca4C0q7W2eMaVZr8iCgF9dKbcVXutftkC7D6z2SaSMmLiDyA== + "@intlify/shared@9.2.0-beta.34", "@intlify/shared@next": version "9.2.0-beta.34" resolved "https://registry.yarnpkg.com/@intlify/shared/-/shared-9.2.0-beta.34.tgz#e8e9a93455eadcc9785fe2e2437fe037fc267f7d" integrity sha512-hbUKcVbTOkLVpnlSeZE1OPgEI7FpvhuZF/gb84xECTjXEImIa3u0fIcJKUUffv3dlAx8fMOE5xKgDzngidm0tw== -"@intlify/shared@9.2.2", "@intlify/shared@^9.2.2": +"@intlify/shared@^9.2.2": version "9.2.2" resolved "https://registry.yarnpkg.com/@intlify/shared/-/shared-9.2.2.tgz#5011be9ca2b4ab86f8660739286e2707f9abb4a5" integrity sha512-wRwTpsslgZS5HNyM7uDQYZtxnbI12aGiBZURX3BTR9RFIKKRWpllTsgzHWvj3HKm3Y2Sh5LPC1r0PDCKEhVn9Q== -"@intlify/vue-devtools@9.2.2": - version "9.2.2" - resolved "https://registry.yarnpkg.com/@intlify/vue-devtools/-/vue-devtools-9.2.2.tgz#b95701556daf7ebb3a2d45aa3ae9e6415aed8317" - integrity sha512-+dUyqyCHWHb/UcvY1MlIpO87munedm3Gn6E9WWYdWrMuYLcoIoOEVDWSS8xSwtlPU+kA+MEQTP6Q1iI/ocusJg== - dependencies: - "@intlify/core-base" "9.2.2" - "@intlify/shared" "9.2.2" - "@intlify/vue-i18n-loader@5.0.1": version "5.0.1" resolved "https://registry.yarnpkg.com/@intlify/vue-i18n-loader/-/vue-i18n-loader-5.0.1.tgz#af7d32059e32138e91495e5240f7ce2adb71c738" @@ -2410,16 +2398,16 @@ resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.1.3.tgz#a44c52e8fa6d22f84db3abdcdd0be5135b7dd7cf" integrity sha512-79InfO2xHv+WHIrH1bHXQUiQD/wMls9qBk6WVwGCbdwP7/3zINtvqPNMtmSHXsIKjvUAHc8L0ouOj6ZQQRmcXg== -"@vue/devtools-api@^6.2.1": - version "6.2.1" - resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.2.1.tgz#6f2948ff002ec46df01420dfeff91de16c5b4092" - integrity sha512-OEgAMeQXvCoJ+1x8WyQuVZzFo0wcyCmUR3baRVLmKBo1LmYZWMlRiXlux5jd0fqVJu6PfDbOrZItVqUEzLobeQ== - "@vue/devtools-api@^6.4.5": version "6.4.5" resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.4.5.tgz#d54e844c1adbb1e677c81c665ecef1a2b4bb8380" integrity sha512-JD5fcdIuFxU4fQyXUu3w2KpAJHzTVdN+p4iOX2lMWSHMOoQdMAcpFLZzm9Z/2nmsoZ1a96QEhZ26e50xLBsgOQ== +"@vue/devtools-api@^6.5.0": + version "6.6.4" + resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.6.4.tgz#cbe97fe0162b365edc1dba80e173f90492535343" + integrity sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g== + "@vue/reactivity-transform@3.2.45": version "3.2.45" resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.45.tgz#07ac83b8138550c83dfb50db43cde1e0e5e8124d" @@ -9206,15 +9194,14 @@ vue-eslint-parser@^9.0.1: lodash "^4.17.21" semver "^7.3.6" -vue-i18n@9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/vue-i18n/-/vue-i18n-9.2.2.tgz#aeb49d9424923c77e0d6441e3f21dafcecd0e666" - integrity sha512-yswpwtj89rTBhegUAv9Mu37LNznyu3NpyLQmozF3i1hYOhwpG8RjcjIFIIfnu+2MDZJGSZPXaKWvnQA71Yv9TQ== +vue-i18n@10: + version "10.0.5" + resolved "https://registry.yarnpkg.com/vue-i18n/-/vue-i18n-10.0.5.tgz#fdf4e6c7b669e80cfa3a12ed9625e2b46671cdf0" + integrity sha512-9/gmDlCblz3i8ypu/afiIc/SUIfTTE1mr0mZhb9pk70xo2csHAM9mp2gdQ3KD2O0AM3Hz/5ypb+FycTj/lHlPQ== dependencies: - "@intlify/core-base" "9.2.2" - "@intlify/shared" "9.2.2" - "@intlify/vue-devtools" "9.2.2" - "@vue/devtools-api" "^6.2.1" + "@intlify/core-base" "10.0.5" + "@intlify/shared" "10.0.5" + "@vue/devtools-api" "^6.5.0" vue-loader@17.0.1: version "17.0.1"