Merge branch 'eintei-port-mute-nsfw' into 'develop'

Ability to mute nsfw posts

Closes #1288

See merge request pleroma/pleroma-fe!1913
This commit is contained in:
HJ 2024-04-28 17:29:17 +00:00
commit 3056017f8e
10 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1 @@
Added ability to mute sensitive posts (ported from eintei)

View File

@ -63,6 +63,13 @@ const QuickFilterSettings = {
const value = !this.muteBotStatuses const value = !this.muteBotStatuses
this.$store.dispatch('setOption', { name: 'muteBotStatuses', value }) 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 })
}
} }
} }
} }

View File

@ -71,6 +71,18 @@
:aria-hidden="true" :aria-hidden="true"
/>{{ $t('settings.mute_bot_posts') }} />{{ $t('settings.mute_bot_posts') }}
</button> </button>
<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 <button
class="menu-item dropdown-item" class="menu-item dropdown-item"
role="menuitemcheckbox" role="menuitemcheckbox"

View File

@ -61,6 +61,13 @@ const QuickViewSettings = {
const value = !this.muteBotStatuses const value = !this.muteBotStatuses
this.$store.dispatch('setOption', { name: 'muteBotStatuses', value }) 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 })
}
} }
} }
} }

View File

@ -44,6 +44,29 @@
{{ $t('settings.mute_bot_posts') }} {{ $t('settings.mute_bot_posts') }}
</BooleanSetting> </BooleanSetting>
</li> </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> <li>
<BooleanSetting path="hidePostStats"> <BooleanSetting path="hidePostStats">
{{ $t('settings.hide_post_stats') }} {{ $t('settings.hide_post_stats') }}

View File

@ -238,6 +238,9 @@ const Status = {
showActorTypeIndicator () { showActorTypeIndicator () {
return !this.hideBotIndication return !this.hideBotIndication
}, },
sensitiveStatus () {
return this.status.nsfw
},
mentionsLine () { mentionsLine () {
if (!this.headTailLinks) return [] if (!this.headTailLinks) return []
const writtenSet = new Set(this.headTailLinks.writtenMentions.map(_ => _.url)) const writtenSet = new Set(this.headTailLinks.writtenMentions.map(_ => _.url))
@ -265,7 +268,9 @@ const Status = {
// Wordfiltered // Wordfiltered
this.muteWordHits.length > 0 || this.muteWordHits.length > 0 ||
// bot status // 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 return !this.unmuted && !this.shouldNotMute && reasonsToMute
}, },
userIsMuted () { userIsMuted () {
@ -371,6 +376,9 @@ const Status = {
muteBotStatuses () { muteBotStatuses () {
return this.mergedConfig.muteBotStatuses return this.mergedConfig.muteBotStatuses
}, },
muteSensitiveStatuses () {
return this.mergedConfig.muteSensitiveStatuses
},
hideBotIndication () { hideBotIndication () {
return this.mergedConfig.hideBotIndication return this.mergedConfig.hideBotIndication
}, },

View File

@ -30,6 +30,12 @@
:at="false" :at="false"
/> />
</small> </small>
<small
v-if="muteSensitiveStatuses && status.nsfw"
class="mute-thread"
>
{{ $t('status.sensitive_muted') }}
</small>
<small <small
v-if="showReasonMutedThread" v-if="showReasonMutedThread"
class="mute-thread" class="mute-thread"

View File

@ -501,6 +501,7 @@
"mute_bot_posts": "Mute bot posts", "mute_bot_posts": "Mute bot posts",
"hide_actor_type_indication": "Hide actor type (bots, groups, etc.) indication in posts", "hide_actor_type_indication": "Hide actor type (bots, groups, etc.) indication in posts",
"hide_scrobbles": "Hide scrobbles", "hide_scrobbles": "Hide scrobbles",
"mute_sensitive_posts": "Mute sensitive posts",
"hide_all_muted_posts": "Hide muted posts", "hide_all_muted_posts": "Hide muted posts",
"max_thumbnails": "Maximum amount of thumbnails per post (empty = no limit)", "max_thumbnails": "Maximum amount of thumbnails per post (empty = no limit)",
"hide_isp": "Hide instance-specific panel", "hide_isp": "Hide instance-specific panel",
@ -1074,6 +1075,7 @@
"external_source": "External source", "external_source": "External source",
"thread_muted": "Thread muted", "thread_muted": "Thread muted",
"thread_muted_and_words": ", has words:", "thread_muted_and_words": ", has words:",
"sensitive_muted": "Muting sensitive content",
"show_full_subject": "Show full subject", "show_full_subject": "Show full subject",
"hide_full_subject": "Hide full subject", "hide_full_subject": "Hide full subject",
"show_content": "Show content", "show_content": "Show content",

View File

@ -36,6 +36,7 @@ export const defaultState = {
hideMutedThreads: undefined, // instance default hideMutedThreads: undefined, // instance default
hideWordFilteredPosts: undefined, // instance default hideWordFilteredPosts: undefined, // instance default
muteBotStatuses: undefined, // instance default muteBotStatuses: undefined, // instance default
muteSensitiveStatuses: undefined, // instance default
collapseMessageWithSubject: undefined, // instance default collapseMessageWithSubject: undefined, // instance default
padEmoji: true, padEmoji: true,
hideAttachments: false, hideAttachments: false,

View File

@ -71,6 +71,7 @@ const defaultState = {
hideSitename: false, hideSitename: false,
hideUserStats: false, hideUserStats: false,
muteBotStatuses: false, muteBotStatuses: false,
muteSensitiveStatuses: false,
modalOnRepeat: false, modalOnRepeat: false,
modalOnUnfollow: false, modalOnUnfollow: false,
modalOnBlock: true, modalOnBlock: true,