commit: 3056017f8e35c98a7fb42162c7e3460a4ebab619
parent 36f2fef55ab370cc51f1ff81b419f28e2f50409b
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date: Sun, 28 Apr 2024 17:29:17 +0000
Merge branch 'eintei-port-mute-nsfw' into 'develop'
Ability to mute nsfw posts
Closes #1288
See merge request pleroma/pleroma-fe!1913
Diffstat:
10 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/changelog.d/mute-nsfw.add b/changelog.d/mute-nsfw.add
@@ -0,0 +1 @@
+Added ability to mute sensitive posts (ported from eintei)
diff --git a/src/components/quick_filter_settings/quick_filter_settings.js b/src/components/quick_filter_settings/quick_filter_settings.js
@@ -63,6 +63,13 @@ const QuickFilterSettings = {
const value = !this.muteBotStatuses
this.$store.dispatch('setOption', { name: 'muteBotStatuses', value })
}
+ },
+ muteSensitiveStatuses: {
+ get () { return this.mergedConfig.muteSensitiveStatuses },
+ set () {
+ const value = !this.muteSensitiveStatuses
+ this.$store.dispatch('setOption', { name: 'muteSensitiveStatuses', value })
+ }
}
}
}
diff --git a/src/components/quick_filter_settings/quick_filter_settings.vue b/src/components/quick_filter_settings/quick_filter_settings.vue
@@ -74,6 +74,18 @@
<button
class="menu-item dropdown-item"
role="menuitemcheckbox"
+ :aria-checked="muteSensitiveStatuses"
+ @click="muteSensitiveStatuses = !muteSensitiveStatuses"
+ >
+ <span
+ class="input menu-checkbox"
+ :class="{ 'menu-checkbox-checked': muteSensitiveStatuses }"
+ :aria-hidden="true"
+ />{{ $t('settings.mute_sensitive_posts') }}
+ </button>
+ <button
+ class="menu-item dropdown-item"
+ role="menuitemcheckbox"
:aria-checked="hideMedia"
@click="hideMedia = !hideMedia"
>
diff --git a/src/components/quick_view_settings/quick_view_settings.js b/src/components/quick_view_settings/quick_view_settings.js
@@ -61,6 +61,13 @@ const QuickViewSettings = {
const value = !this.muteBotStatuses
this.$store.dispatch('setOption', { name: 'muteBotStatuses', value })
}
+ },
+ muteSensitiveStatuses: {
+ get () { return this.mergedConfig.muteSensitiveStatuses },
+ set () {
+ const value = !this.muteSensitiveStatuses
+ this.$store.dispatch('setOption', { name: 'muteSensitiveStatuses', value })
+ }
}
}
}
diff --git a/src/components/settings_modal/tabs/filtering_tab.vue b/src/components/settings_modal/tabs/filtering_tab.vue
@@ -45,6 +45,29 @@
</BooleanSetting>
</li>
<li>
+ <BooleanSetting path="muteSensitiveStatuses">
+ {{ $t('settings.mute_sensitive_posts') }}
+ </BooleanSetting>
+ </li>
+ <li>
+ <BooleanSetting path="hideMutedFederationRestrictions">
+ {{ $t('settings.hide_muted_federation_restrictions') }}
+ </BooleanSetting>
+ <ul
+ class="setting-list suboptions"
+ :class="[{disabled: !streaming}]"
+ >
+ <li
+ v-for="item in muteFederationRestrictionsLevels"
+ :key="'mute_' + item + '_federation_restriction'"
+ >
+ <BooleanSetting :path="'muteFederationRestrictions.' + item">
+ {{ $t('settings.mute_' + item + '_federation_restriction') }}
+ </BooleanSetting>
+ </li>
+ </ul>
+ </li>
+ <li>
<BooleanSetting path="hidePostStats">
{{ $t('settings.hide_post_stats') }}
</BooleanSetting>
diff --git a/src/components/status/status.js b/src/components/status/status.js
@@ -238,6 +238,9 @@ const Status = {
showActorTypeIndicator () {
return !this.hideBotIndication
},
+ sensitiveStatus () {
+ return this.status.nsfw
+ },
mentionsLine () {
if (!this.headTailLinks) return []
const writtenSet = new Set(this.headTailLinks.writtenMentions.map(_ => _.url))
@@ -265,7 +268,9 @@ const Status = {
// Wordfiltered
this.muteWordHits.length > 0 ||
// bot status
- (this.muteBotStatuses && this.botStatus && !this.compact)
+ (this.muteBotStatuses && this.botStatus && !this.compact) ||
+ // sensitive status
+ (this.muteSensitiveStatuses && this.sensitiveStatus && !this.compact)
return !this.unmuted && !this.shouldNotMute && reasonsToMute
},
userIsMuted () {
@@ -371,6 +376,9 @@ const Status = {
muteBotStatuses () {
return this.mergedConfig.muteBotStatuses
},
+ muteSensitiveStatuses () {
+ return this.mergedConfig.muteSensitiveStatuses
+ },
hideBotIndication () {
return this.mergedConfig.hideBotIndication
},
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
@@ -31,6 +31,12 @@
/>
</small>
<small
+ v-if="muteSensitiveStatuses && status.nsfw"
+ class="mute-thread"
+ >
+ {{ $t('status.sensitive_muted') }}
+ </small>
+ <small
v-if="showReasonMutedThread"
class="mute-thread"
>
diff --git a/src/i18n/en.json b/src/i18n/en.json
@@ -501,6 +501,7 @@
"mute_bot_posts": "Mute bot posts",
"hide_actor_type_indication": "Hide actor type (bots, groups, etc.) indication in posts",
"hide_scrobbles": "Hide scrobbles",
+ "mute_sensitive_posts": "Mute sensitive posts",
"hide_all_muted_posts": "Hide muted posts",
"max_thumbnails": "Maximum amount of thumbnails per post (empty = no limit)",
"hide_isp": "Hide instance-specific panel",
@@ -1074,6 +1075,7 @@
"external_source": "External source",
"thread_muted": "Thread muted",
"thread_muted_and_words": ", has words:",
+ "sensitive_muted": "Muting sensitive content",
"show_full_subject": "Show full subject",
"hide_full_subject": "Hide full subject",
"show_content": "Show content",
diff --git a/src/modules/config.js b/src/modules/config.js
@@ -36,6 +36,7 @@ export const defaultState = {
hideMutedThreads: undefined, // instance default
hideWordFilteredPosts: undefined, // instance default
muteBotStatuses: undefined, // instance default
+ muteSensitiveStatuses: undefined, // instance default
collapseMessageWithSubject: undefined, // instance default
padEmoji: true,
hideAttachments: false,
diff --git a/src/modules/instance.js b/src/modules/instance.js
@@ -71,6 +71,7 @@ const defaultState = {
hideSitename: false,
hideUserStats: false,
muteBotStatuses: false,
+ muteSensitiveStatuses: false,
modalOnRepeat: false,
modalOnUnfollow: false,
modalOnBlock: true,