Compare commits

...

8 commits

Author SHA1 Message Date
Henry Jameson
3b2bc69341 Merge branch 'themes3-cache' into shigusegubu-themes3 2024-04-24 15:59:32 +03:00
Henry Jameson
cc65ad7155 Merge branch 'eintei-port-mute-nsfw' into shigusegubu-themes3 2024-04-24 15:59:13 +03:00
Henry Jameson
c1ca56a384 Merge branch 'scrobbles-age' into shigusegubu-themes3 2024-04-24 15:58:55 +03:00
Henry Jameson
6ff0a7f021 refactor sizesetting into unitsetting allowing more unit types with i18n support 2024-04-24 15:58:26 +03:00
Henry Jameson
6473260487 changelog 2024-04-24 15:25:21 +03:00
Henry Jameson
046678086f add explanation to why post is muted for sensitive muting 2024-04-24 15:22:19 +03:00
Alexander Tumin
59656af44c Allow muting sensitive posts in public timelines 2024-04-24 15:18:11 +03:00
Henry Jameson
6ea69eb51a checksum -> engineChecksum for clarity 2024-04-24 15:09:52 +03:00
19 changed files with 110 additions and 34 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

@ -17,6 +17,10 @@ export default {
units: { units: {
type: Array, type: Array,
default: () => allCssUnits default: () => allCssUnits
},
unitSet: {
type: String,
default: 'none'
} }
}, },
computed: { computed: {
@ -30,6 +34,10 @@ export default {
}, },
methods: { methods: {
...Setting.methods, ...Setting.methods,
getUnitString (value) {
if (this.unitSet === 'none') return value
return this.$t(['settings', 'units', this.unitSet, value].join('.'))
},
updateValue (e) { updateValue (e) {
this.configSink(this.path, parseInt(e.target.value) + this.stateUnit) this.configSink(this.path, parseInt(e.target.value) + this.stateUnit)
}, },

View file

@ -1,7 +1,7 @@
<template> <template>
<span <span
v-if="matchesExpertLevel" v-if="matchesExpertLevel"
class="SizeSetting" class="UnitSetting"
> >
<label <label
:for="path" :for="path"
@ -23,7 +23,7 @@
:id="path" :id="path"
:model-value="stateUnit" :model-value="stateUnit"
:disabled="disabled" :disabled="disabled"
class="css-unit-input" class="unit-input unstyled"
@change="updateUnit" @change="updateUnit"
> >
<option <option
@ -31,7 +31,7 @@
:key="option" :key="option"
:value="option" :value="option"
> >
{{ option }} {{ getUnitString(option) }}
</option> </option>
</Select> </Select>
{{ ' ' }} {{ ' ' }}
@ -42,20 +42,19 @@
</span> </span>
</template> </template>
<script src="./size_setting.js"></script> <script src="./unit_setting.js"></script>
<style lang="scss"> <style lang="scss">
.SizeSetting { .UnitSetting {
.number-input { .number-input {
max-width: 6.5em; max-width: 6.5em;
text-align: right;
} }
.css-unit-input, .unit-input,
.css-unit-input select { .unit-input select {
margin-left: 0.5em;
width: 4em;
max-width: 4em;
min-width: 4em; min-width: 4em;
width: auto;
} }
} }

View file

@ -31,10 +31,6 @@
margin-bottom: 1em; margin-bottom: 1em;
} }
select {
min-width: 10em;
}
textarea { textarea {
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;

View file

@ -31,10 +31,6 @@
margin-bottom: 1em; margin-bottom: 1em;
} }
select {
min-width: 10em;
}
textarea { textarea {
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;

View file

@ -1,7 +1,7 @@
import { filter, trim, debounce } from 'lodash' import { filter, trim, debounce } from 'lodash'
import BooleanSetting from '../helpers/boolean_setting.vue' import BooleanSetting from '../helpers/boolean_setting.vue'
import ChoiceSetting from '../helpers/choice_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 IntegerSetting from '../helpers/integer_setting.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js' import SharedComputedObject from '../helpers/shared_computed_object.js'
@ -20,7 +20,7 @@ const FilteringTab = {
components: { components: {
BooleanSetting, BooleanSetting,
ChoiceSetting, ChoiceSetting,
SizeSetting, UnitSetting,
IntegerSetting IntegerSetting
}, },
computed: { computed: {

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') }}
@ -97,14 +120,15 @@
</BooleanSetting> </BooleanSetting>
</li> </li>
<li> <li>
<SizeSetting <UnitSetting
key="hideScrobblesAfter" key="hideScrobblesAfter"
path="hideScrobblesAfter" path="hideScrobblesAfter"
:units="['m', 'h', 'd']" :units="['m', 'h', 'd']"
unitSet="time"
expert="1" expert="1"
> >
{{ $t('settings.hide_scrobbles_after') }} {{ $t('settings.hide_scrobbles_after') }}
</SizeSetting> </UnitSetting>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -3,7 +3,7 @@ import ChoiceSetting from '../helpers/choice_setting.vue'
import ScopeSelector from 'src/components/scope_selector/scope_selector.vue' import ScopeSelector from 'src/components/scope_selector/scope_selector.vue'
import IntegerSetting from '../helpers/integer_setting.vue' import IntegerSetting from '../helpers/integer_setting.vue'
import FloatSetting from '../helpers/float_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 InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js' import SharedComputedObject from '../helpers/shared_computed_object.js'
@ -64,7 +64,7 @@ const GeneralTab = {
ChoiceSetting, ChoiceSetting,
IntegerSetting, IntegerSetting,
FloatSetting, FloatSetting,
SizeSetting, UnitSetting,
InterfaceLanguageSwitcher, InterfaceLanguageSwitcher,
ScopeSelector, ScopeSelector,
ProfileSettingIndicator ProfileSettingIndicator

View file

@ -134,7 +134,7 @@
<li v-if="expertLevel > 0"> <li v-if="expertLevel > 0">
{{ $t('settings.column_sizes') }} {{ $t('settings.column_sizes') }}
<div class="column-settings"> <div class="column-settings">
<SizeSetting <UnitSetting
v-for="column in columns" v-for="column in columns"
:key="column" :key="column"
:path="column + 'ColumnWidth'" :path="column + 'ColumnWidth'"
@ -142,7 +142,7 @@
expert="1" expert="1"
> >
{{ $t('settings.column_sizes_' + column) }} {{ $t('settings.column_sizes_' + column) }}
</SizeSetting> </UnitSetting>
</div> </div>
</li> </li>
<li class="select-multiple"> <li class="select-multiple">

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

@ -394,6 +394,14 @@
"desc": "To enable two-factor authentication, enter the code from your two-factor app:" "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", "lists_navigation": "Show lists in navigation",
"allow_following_move": "Allow auto-follow when following account moves", "allow_following_move": "Allow auto-follow when following account moves",
"attachmentRadius": "Attachments", "attachmentRadius": "Attachments",
@ -502,6 +510,7 @@
"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",
"hide_scrobbles_after": "Hide scrobbles older than", "hide_scrobbles_after": "Hide scrobbles older than",
"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",
@ -1076,6 +1085,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

@ -37,6 +37,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,

View file

@ -1,6 +1,6 @@
import { hex2rgb } from '../color_convert/color_convert.js' import { hex2rgb } from '../color_convert/color_convert.js'
import { generatePreset } from '../theme_data/theme_data.service.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 { convertTheme2To3 } from '../theme_data/theme2_to_theme3.js'
import { getCssRules } from '../theme_data/css_utils.js' import { getCssRules } from '../theme_data/css_utils.js'
import { defaultState } from '../../modules/config.js' import { defaultState } from '../../modules/config.js'
@ -97,7 +97,7 @@ export const tryLoadCache = () => {
console.error('Failed to decode theme cache:', e) console.error('Failed to decode theme cache:', e)
return false return false
} }
if (cache.checksum === getChecksum()) { if (cache.engineChecksum === getEngineChecksum()) {
const styleSheet = new CSSStyleSheet() const styleSheet = new CSSStyleSheet()
const lazyStyleSheet = new CSSStyleSheet() const lazyStyleSheet = new CSSStyleSheet()
@ -108,7 +108,7 @@ export const tryLoadCache = () => {
return true return true
} else { } 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') localStorage.removeItem('pleroma-fe-theme-cache')
} }
} }
@ -136,7 +136,7 @@ export const applyTheme = async (input, onFinish = (data) => {}) => {
}, },
onLazyFinished () { onLazyFinished () {
document.adoptedStyleSheets = [styleSheet, lazyStyleSheet] document.adoptedStyleSheets = [styleSheet, lazyStyleSheet]
const cache = { checksum: getChecksum(), data: [styleArray, lazyStyleArray] } const cache = { engineChecksum: getEngineChecksum(), data: [styleArray, lazyStyleArray] }
onFinish(cache) onFinish(cache)
localStorage.setItem('pleroma-fe-theme-cache', JSON.stringify(cache)) localStorage.setItem('pleroma-fe-theme-cache', JSON.stringify(cache))
} }

View file

@ -143,11 +143,11 @@ componentsContext.keys().forEach(key => {
components[component.name] = component components[component.name] = component
}) })
const checksum = sum(components) const engineChecksum = sum(components)
const ruleToSelector = genericRuleToSelector(components) const ruleToSelector = genericRuleToSelector(components)
export const getChecksum = () => checksum export const getEngineChecksum = () => engineChecksum
export const init = (extraRuleset, ultimateBackgroundColor) => { export const init = (extraRuleset, ultimateBackgroundColor) => {
const staticVars = {} const staticVars = {}
@ -469,6 +469,6 @@ export const init = (extraRuleset, ultimateBackgroundColor) => {
lazy: result.filter(x => typeof x === 'function'), lazy: result.filter(x => typeof x === 'function'),
eager: result.filter(x => typeof x !== 'function'), eager: result.filter(x => typeof x !== 'function'),
staticVars, staticVars,
checksum engineChecksum
} }
} }