Compare commits
8 commits
14bde0fc47
...
3b2bc69341
Author | SHA1 | Date | |
---|---|---|---|
|
3b2bc69341 | ||
|
cc65ad7155 | ||
|
c1ca56a384 | ||
|
6ff0a7f021 | ||
|
6473260487 | ||
|
046678086f | ||
|
59656af44c | ||
|
6ea69eb51a |
19 changed files with 110 additions and 34 deletions
1
changelog.d/mute-nsfw.add
Normal file
1
changelog.d/mute-nsfw.add
Normal file
|
@ -0,0 +1 @@
|
|||
Added ability to mute sensitive posts (ported from eintei)
|
|
@ -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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,18 @@
|
|||
:aria-hidden="true"
|
||||
/>{{ $t('settings.mute_bot_posts') }}
|
||||
</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
|
||||
class="menu-item dropdown-item"
|
||||
role="menuitemcheckbox"
|
||||
|
|
|
@ -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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,10 @@ export default {
|
|||
units: {
|
||||
type: Array,
|
||||
default: () => allCssUnits
|
||||
},
|
||||
unitSet: {
|
||||
type: String,
|
||||
default: 'none'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -30,6 +34,10 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
...Setting.methods,
|
||||
getUnitString (value) {
|
||||
if (this.unitSet === 'none') return value
|
||||
return this.$t(['settings', 'units', this.unitSet, value].join('.'))
|
||||
},
|
||||
updateValue (e) {
|
||||
this.configSink(this.path, parseInt(e.target.value) + this.stateUnit)
|
||||
},
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<span
|
||||
v-if="matchesExpertLevel"
|
||||
class="SizeSetting"
|
||||
class="UnitSetting"
|
||||
>
|
||||
<label
|
||||
:for="path"
|
||||
|
@ -23,7 +23,7 @@
|
|||
:id="path"
|
||||
:model-value="stateUnit"
|
||||
:disabled="disabled"
|
||||
class="css-unit-input"
|
||||
class="unit-input unstyled"
|
||||
@change="updateUnit"
|
||||
>
|
||||
<option
|
||||
|
@ -31,7 +31,7 @@
|
|||
:key="option"
|
||||
:value="option"
|
||||
>
|
||||
{{ option }}
|
||||
{{ getUnitString(option) }}
|
||||
</option>
|
||||
</Select>
|
||||
{{ ' ' }}
|
||||
|
@ -42,20 +42,19 @@
|
|||
</span>
|
||||
</template>
|
||||
|
||||
<script src="./size_setting.js"></script>
|
||||
<script src="./unit_setting.js"></script>
|
||||
|
||||
<style lang="scss">
|
||||
.SizeSetting {
|
||||
.UnitSetting {
|
||||
.number-input {
|
||||
max-width: 6.5em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.css-unit-input,
|
||||
.css-unit-input select {
|
||||
margin-left: 0.5em;
|
||||
width: 4em;
|
||||
max-width: 4em;
|
||||
.unit-input,
|
||||
.unit-input select {
|
||||
min-width: 4em;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,10 +31,6 @@
|
|||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
select {
|
||||
min-width: 10em;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
select {
|
||||
min-width: 10em;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { filter, trim, debounce } from 'lodash'
|
||||
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||
import ChoiceSetting from '../helpers/choice_setting.vue'
|
||||
import SizeSetting from '../helpers/size_setting.vue'
|
||||
import UnitSetting from '../helpers/unit_setting.vue'
|
||||
import IntegerSetting from '../helpers/integer_setting.vue'
|
||||
|
||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
|
@ -20,7 +20,7 @@ const FilteringTab = {
|
|||
components: {
|
||||
BooleanSetting,
|
||||
ChoiceSetting,
|
||||
SizeSetting,
|
||||
UnitSetting,
|
||||
IntegerSetting
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -44,6 +44,29 @@
|
|||
{{ $t('settings.mute_bot_posts') }}
|
||||
</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') }}
|
||||
|
@ -97,14 +120,15 @@
|
|||
</BooleanSetting>
|
||||
</li>
|
||||
<li>
|
||||
<SizeSetting
|
||||
<UnitSetting
|
||||
key="hideScrobblesAfter"
|
||||
path="hideScrobblesAfter"
|
||||
:units="['m', 'h', 'd']"
|
||||
unitSet="time"
|
||||
expert="1"
|
||||
>
|
||||
{{ $t('settings.hide_scrobbles_after') }}
|
||||
</SizeSetting>
|
||||
</UnitSetting>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@ import ChoiceSetting from '../helpers/choice_setting.vue'
|
|||
import ScopeSelector from 'src/components/scope_selector/scope_selector.vue'
|
||||
import IntegerSetting from '../helpers/integer_setting.vue'
|
||||
import FloatSetting from '../helpers/float_setting.vue'
|
||||
import SizeSetting, { defaultHorizontalUnits } from '../helpers/size_setting.vue'
|
||||
import UnitSetting, { defaultHorizontalUnits } from '../helpers/unit_setting.vue'
|
||||
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
|
||||
|
||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||
|
@ -64,7 +64,7 @@ const GeneralTab = {
|
|||
ChoiceSetting,
|
||||
IntegerSetting,
|
||||
FloatSetting,
|
||||
SizeSetting,
|
||||
UnitSetting,
|
||||
InterfaceLanguageSwitcher,
|
||||
ScopeSelector,
|
||||
ProfileSettingIndicator
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
<li v-if="expertLevel > 0">
|
||||
{{ $t('settings.column_sizes') }}
|
||||
<div class="column-settings">
|
||||
<SizeSetting
|
||||
<UnitSetting
|
||||
v-for="column in columns"
|
||||
:key="column"
|
||||
:path="column + 'ColumnWidth'"
|
||||
|
@ -142,7 +142,7 @@
|
|||
expert="1"
|
||||
>
|
||||
{{ $t('settings.column_sizes_' + column) }}
|
||||
</SizeSetting>
|
||||
</UnitSetting>
|
||||
</div>
|
||||
</li>
|
||||
<li class="select-multiple">
|
||||
|
|
|
@ -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
|
||||
},
|
||||
|
|
|
@ -30,6 +30,12 @@
|
|||
:at="false"
|
||||
/>
|
||||
</small>
|
||||
<small
|
||||
v-if="muteSensitiveStatuses && status.nsfw"
|
||||
class="mute-thread"
|
||||
>
|
||||
{{ $t('status.sensitive_muted') }}
|
||||
</small>
|
||||
<small
|
||||
v-if="showReasonMutedThread"
|
||||
class="mute-thread"
|
||||
|
|
|
@ -394,6 +394,14 @@
|
|||
"desc": "To enable two-factor authentication, enter the code from your two-factor app:"
|
||||
}
|
||||
},
|
||||
"units": {
|
||||
"time": {
|
||||
"m": "minutes",
|
||||
"s": "seconds",
|
||||
"h": "hours",
|
||||
"d": "days"
|
||||
}
|
||||
},
|
||||
"lists_navigation": "Show lists in navigation",
|
||||
"allow_following_move": "Allow auto-follow when following account moves",
|
||||
"attachmentRadius": "Attachments",
|
||||
|
@ -502,6 +510,7 @@
|
|||
"hide_actor_type_indication": "Hide actor type (bots, groups, etc.) indication in posts",
|
||||
"hide_scrobbles": "Hide scrobbles",
|
||||
"hide_scrobbles_after": "Hide scrobbles older than",
|
||||
"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",
|
||||
|
@ -1076,6 +1085,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",
|
||||
|
|
|
@ -37,6 +37,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,
|
||||
|
|
|
@ -71,6 +71,7 @@ const defaultState = {
|
|||
hideSitename: false,
|
||||
hideUserStats: false,
|
||||
muteBotStatuses: false,
|
||||
muteSensitiveStatuses: false,
|
||||
modalOnRepeat: false,
|
||||
modalOnUnfollow: false,
|
||||
modalOnBlock: true,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { hex2rgb } from '../color_convert/color_convert.js'
|
||||
import { generatePreset } from '../theme_data/theme_data.service.js'
|
||||
import { init, getChecksum } from '../theme_data/theme_data_3.service.js'
|
||||
import { init, getEngineChecksum } from '../theme_data/theme_data_3.service.js'
|
||||
import { convertTheme2To3 } from '../theme_data/theme2_to_theme3.js'
|
||||
import { getCssRules } from '../theme_data/css_utils.js'
|
||||
import { defaultState } from '../../modules/config.js'
|
||||
|
@ -97,7 +97,7 @@ export const tryLoadCache = () => {
|
|||
console.error('Failed to decode theme cache:', e)
|
||||
return false
|
||||
}
|
||||
if (cache.checksum === getChecksum()) {
|
||||
if (cache.engineChecksum === getEngineChecksum()) {
|
||||
const styleSheet = new CSSStyleSheet()
|
||||
const lazyStyleSheet = new CSSStyleSheet()
|
||||
|
||||
|
@ -108,7 +108,7 @@ export const tryLoadCache = () => {
|
|||
|
||||
return true
|
||||
} else {
|
||||
console.warn('Checksum doesn\'t match, cache not usable, clearing')
|
||||
console.warn('Engine checksum doesn\'t match, cache not usable, clearing')
|
||||
localStorage.removeItem('pleroma-fe-theme-cache')
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ export const applyTheme = async (input, onFinish = (data) => {}) => {
|
|||
},
|
||||
onLazyFinished () {
|
||||
document.adoptedStyleSheets = [styleSheet, lazyStyleSheet]
|
||||
const cache = { checksum: getChecksum(), data: [styleArray, lazyStyleArray] }
|
||||
const cache = { engineChecksum: getEngineChecksum(), data: [styleArray, lazyStyleArray] }
|
||||
onFinish(cache)
|
||||
localStorage.setItem('pleroma-fe-theme-cache', JSON.stringify(cache))
|
||||
}
|
||||
|
|
|
@ -143,11 +143,11 @@ componentsContext.keys().forEach(key => {
|
|||
components[component.name] = component
|
||||
})
|
||||
|
||||
const checksum = sum(components)
|
||||
const engineChecksum = sum(components)
|
||||
|
||||
const ruleToSelector = genericRuleToSelector(components)
|
||||
|
||||
export const getChecksum = () => checksum
|
||||
export const getEngineChecksum = () => engineChecksum
|
||||
|
||||
export const init = (extraRuleset, ultimateBackgroundColor) => {
|
||||
const staticVars = {}
|
||||
|
@ -469,6 +469,6 @@ export const init = (extraRuleset, ultimateBackgroundColor) => {
|
|||
lazy: result.filter(x => typeof x === 'function'),
|
||||
eager: result.filter(x => typeof x !== 'function'),
|
||||
staticVars,
|
||||
checksum
|
||||
engineChecksum
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue