forked from AkkomaGang/akkoma-fe
Add settings for max depth in thread
This commit is contained in:
parent
ff5f69b8fd
commit
2e54cf12c7
4 changed files with 26 additions and 6 deletions
|
@ -74,7 +74,11 @@ const conversation = {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
maxDepthToShowByDefault () {
|
maxDepthToShowByDefault () {
|
||||||
return 4
|
// maxDepthInThread = max number of depths that is *visible*
|
||||||
|
// since our depth starts with 0 and "showing" means "showing children"
|
||||||
|
// there is a -2 here
|
||||||
|
const maxDepth = this.$store.getters.mergedConfig.maxDepthInThread - 2
|
||||||
|
return maxDepth >= 1 ? maxDepth : 1
|
||||||
},
|
},
|
||||||
displayStyle () {
|
displayStyle () {
|
||||||
return this.$store.getters.mergedConfig.conversationDisplay
|
return this.$store.getters.mergedConfig.conversationDisplay
|
||||||
|
@ -351,7 +355,8 @@ const conversation = {
|
||||||
}
|
}
|
||||||
this._diven = true
|
this._diven = true
|
||||||
const parentOrSelf = this.parentOrSelf(this.originalStatusId)
|
const parentOrSelf = this.parentOrSelf(this.originalStatusId)
|
||||||
if (this.threadDisplayStatus[this.statusId] === 'hidden') {
|
// If current status is not visible
|
||||||
|
if (this.threadDisplayStatus[parentOrSelf] === 'hidden') {
|
||||||
this.diveIntoStatus(parentOrSelf, /* preventScroll */ true)
|
this.diveIntoStatus(parentOrSelf, /* preventScroll */ true)
|
||||||
this.tryScrollTo(this.statusId)
|
this.tryScrollTo(this.statusId)
|
||||||
}
|
}
|
||||||
|
@ -429,7 +434,7 @@ const conversation = {
|
||||||
toggleStatusContentProperty (id, name) {
|
toggleStatusContentProperty (id, name) {
|
||||||
this.setStatusContentProperty(id, name, !this.statusContentProperties[id][name])
|
this.setStatusContentProperty(id, name, !this.statusContentProperties[id][name])
|
||||||
},
|
},
|
||||||
leastShowingAncestor (id) {
|
leastVisibleAncestor (id) {
|
||||||
let cur = id
|
let cur = id
|
||||||
let parent = this.parentOf(cur)
|
let parent = this.parentOf(cur)
|
||||||
while (cur) {
|
while (cur) {
|
||||||
|
@ -453,14 +458,14 @@ const conversation = {
|
||||||
const oldHighlight = this.highlight
|
const oldHighlight = this.highlight
|
||||||
this.diveHistory = [...this.diveHistory.slice(0, this.diveHistory.length - 1)]
|
this.diveHistory = [...this.diveHistory.slice(0, this.diveHistory.length - 1)]
|
||||||
if (oldHighlight) {
|
if (oldHighlight) {
|
||||||
this.tryScrollTo(this.leastShowingAncestor(oldHighlight))
|
this.tryScrollTo(this.leastVisibleAncestor(oldHighlight))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
undive () {
|
undive () {
|
||||||
const oldHighlight = this.highlight
|
const oldHighlight = this.highlight
|
||||||
this.diveHistory = []
|
this.diveHistory = []
|
||||||
if (oldHighlight) {
|
if (oldHighlight) {
|
||||||
this.tryScrollTo(this.leastShowingAncestor(oldHighlight))
|
this.tryScrollTo(this.leastVisibleAncestor(oldHighlight))
|
||||||
} else {
|
} else {
|
||||||
this.goToCurrent()
|
this.goToCurrent()
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,19 @@
|
||||||
{{ $t('settings.conversation_display') }}
|
{{ $t('settings.conversation_display') }}
|
||||||
</ChoiceSetting>
|
</ChoiceSetting>
|
||||||
</li>
|
</li>
|
||||||
|
<li v-if="conversationDisplay !== 'linear'">
|
||||||
|
<label for="maxDepthInThread">
|
||||||
|
{{ $t('settings.max_depth_in_thread') }}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
id="maxDepthInThread"
|
||||||
|
path.number="maxDepthInThread"
|
||||||
|
class="number-input"
|
||||||
|
type="number"
|
||||||
|
min="3"
|
||||||
|
step="1"
|
||||||
|
>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<ChoiceSetting
|
<ChoiceSetting
|
||||||
id="mentionLinkDisplay"
|
id="mentionLinkDisplay"
|
||||||
|
|
|
@ -83,7 +83,8 @@ export const defaultState = {
|
||||||
hideUserStats: undefined, // instance default
|
hideUserStats: undefined, // instance default
|
||||||
virtualScrolling: undefined, // instance default
|
virtualScrolling: undefined, // instance default
|
||||||
sensitiveByDefault: undefined, // instance default
|
sensitiveByDefault: undefined, // instance default
|
||||||
conversationDisplay: undefined // instance default
|
conversationDisplay: undefined, // instance default
|
||||||
|
maxDepthInThread: 6
|
||||||
}
|
}
|
||||||
|
|
||||||
// caching the instance default properties
|
// caching the instance default properties
|
||||||
|
|
|
@ -54,6 +54,7 @@ const defaultState = {
|
||||||
virtualScrolling: true,
|
virtualScrolling: true,
|
||||||
sensitiveByDefault: false,
|
sensitiveByDefault: false,
|
||||||
conversationDisplay: 'simple_tree',
|
conversationDisplay: 'simple_tree',
|
||||||
|
maxDepthInThread: 6,
|
||||||
|
|
||||||
// Nasty stuff
|
// Nasty stuff
|
||||||
customEmoji: [],
|
customEmoji: [],
|
||||||
|
|
Loading…
Reference in a new issue