hide list add string if not in expert mode

This commit is contained in:
Henry Jameson 2025-12-04 15:24:07 +02:00
commit 3fca18e248
4 changed files with 33 additions and 14 deletions

View file

@ -16,7 +16,10 @@
<BooleanSetting path=":pleroma.:media_proxy.:proxy_opts.:redirect_on_failure" /> <BooleanSetting path=":pleroma.:media_proxy.:proxy_opts.:redirect_on_failure" />
</li> </li>
<li> <li>
<ListSetting path=":pleroma.:media_proxy.:whitelist" /> <ListSetting
ignore-suggestions
path=":pleroma.:media_proxy.:whitelist"
/>
</li> </li>
</ul> </ul>
</li> </li>
@ -44,6 +47,7 @@
</li> </li>
<li> <li>
<ListSetting <ListSetting
ignore-suggestions
:path="[':pleroma', 'Pleroma.Web.MediaProxy.Invalidation.Http', ':headers']" :path="[':pleroma', 'Pleroma.Web.MediaProxy.Invalidation.Http', ':headers']"
parent-path=":pleroma.:media_proxy.:invalidation.:enabled" parent-path=":pleroma.:media_proxy.:invalidation.:enabled"
/> />

View file

@ -24,27 +24,46 @@ export default {
}, },
allowNew: { allowNew: {
required: false, required: false,
type: Set, type: Boolean,
default: true default: true
},
forceNew: {
required: false,
type: Boolean,
default: false
} }
}, },
computed: { computed: {
...Setting.computed, ...Setting.computed,
showNew () {
if (this.forceNew) return true
if (!this.allowNew) return false
const isExpert = this.$store.state.config.expertLevel > 0
const hasBuiltins = this.builtinEntries.length > 0
if (hasBuiltins) {
return isExpert
} else {
return true
}
},
valueSet () { valueSet () {
return new Set(this.visibleState) return new Set(this.visibleState)
}, },
suggestions () { suggestionsSet () {
const suggestions = this.backendDescription?.suggestions const suggestions = this.backendDescriptionSuggestions
if (suggestions) { if (suggestions) {
return new Set(this.backendDescription.suggestions) return new Set(suggestions)
} else { } else {
return new Set() return new Set()
} }
}, },
extraEntries () { extraEntries () {
if (this.ignoreSuggestions) return [...this.valueSet.values()] if (this.ignoreSuggestions) return [...this.valueSet.values()]
if (!this.suggestionsSet) return []
return [...this.valueSet.values()].filter((x) => { return [...this.valueSet.values()].filter((x) => {
return !this.suggestions?.has(x) return !this.suggestionsSet?.has(x)
}) })
}, },
builtinEntries () { builtinEntries () {
@ -52,14 +71,12 @@ export default {
if (this.overrideAvailableOptions) { if (this.overrideAvailableOptions) {
return [...this.overrideAvailableOptions] return [...this.overrideAvailableOptions]
} }
if (!this.suggestionsSet) return []
const builtins = [...this.valueSet.values()].filter((x) => { const builtins = [...this.suggestionsSet.values()]
return this.suggestions.has(x)
})
return builtins.map((option) => ({ return builtins.map((option) => ({
label: option, label: option,
value: option value: this.valueSet.has(option)
})) }))
} }
}, },

View file

@ -48,7 +48,7 @@
</button> </button>
</div> </div>
</li> </li>
<li v-if="allowNew"> <li v-if="showNew">
<div class="btn-group"> <div class="btn-group">
<input <input
class="input string-input" class="input string-input"

View file

@ -235,7 +235,6 @@ export default {
}, },
descriptionPath () { descriptionPath () {
if (this.path == null) return null if (this.path == null) return null
if (this.backendDescriptionPath) return this.backendDescriptionPath
const path = Array.isArray(this.path) ? this.path : this.path.split('.') const path = Array.isArray(this.path) ? this.path : this.path.split('.')
if (this.subgroup) { if (this.subgroup) {
return [ return [
@ -279,7 +278,6 @@ export default {
} }
}, },
reset () { reset () {
console.log('RS', this.state, this.draft)
if (this.realDraftMode) { if (this.realDraftMode) {
this.draft = cloneDeep(this.state) this.draft = cloneDeep(this.state)
} else { } else {