Handle recursive quotes
This commit is contained in:
parent
d72486f3e4
commit
d22079cf73
@ -281,7 +281,7 @@ const PostStatusForm = {
|
|||||||
repliedStatus.visibility === 'local') {
|
repliedStatus.visibility === 'local') {
|
||||||
return true
|
return true
|
||||||
} else if (repliedStatus.visibility === 'private') {
|
} else if (repliedStatus.visibility === 'private') {
|
||||||
return repliedStatus.account.id === this.$store.state.users.currentUser.id
|
return repliedStatus.user.id === this.$store.state.users.currentUser.id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapGetters(['mergedConfig']),
|
||||||
|
@ -133,6 +133,7 @@ const Status = {
|
|||||||
'showPinned',
|
'showPinned',
|
||||||
'inProfile',
|
'inProfile',
|
||||||
'profileUserId',
|
'profileUserId',
|
||||||
|
'inQuote',
|
||||||
|
|
||||||
'simpleTree',
|
'simpleTree',
|
||||||
'controlledThreadDisplayStatus',
|
'controlledThreadDisplayStatus',
|
||||||
@ -159,7 +160,8 @@ const Status = {
|
|||||||
uncontrolledMediaPlaying: [],
|
uncontrolledMediaPlaying: [],
|
||||||
suspendable: true,
|
suspendable: true,
|
||||||
error: null,
|
error: null,
|
||||||
headTailLinks: null
|
headTailLinks: null,
|
||||||
|
displayQuote: !this.inQuote
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -402,8 +404,17 @@ const Status = {
|
|||||||
editingAvailable () {
|
editingAvailable () {
|
||||||
return this.$store.state.instance.editingAvailable
|
return this.$store.state.instance.editingAvailable
|
||||||
},
|
},
|
||||||
|
hasVisibleQuote () {
|
||||||
|
return this.status.quote_url && this.status.quote_visible
|
||||||
|
},
|
||||||
|
hasInvisibleQuote () {
|
||||||
|
return this.status.quote_url && !this.status.quote_visible
|
||||||
|
},
|
||||||
quotedStatus () {
|
quotedStatus () {
|
||||||
return this.status.quote_id ? this.$store.state.statuses.allStatusesObject[this.status.quote_id] : undefined
|
return this.status.quote_id ? this.$store.state.statuses.allStatusesObject[this.status.quote_id] : undefined
|
||||||
|
},
|
||||||
|
shouldDisplayQuote () {
|
||||||
|
return this.quotedStatus && this.displayQuote
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -472,6 +483,18 @@ const Status = {
|
|||||||
window.scrollBy(0, rect.bottom - window.innerHeight + 50)
|
window.scrollBy(0, rect.bottom - window.innerHeight + 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
toggleDisplayQuote () {
|
||||||
|
if (this.shouldDisplayQuote) {
|
||||||
|
this.displayQuote = false
|
||||||
|
} else if (!this.quotedStatus) {
|
||||||
|
this.$store.dispatch('fetchStatus', this.status.quote_id)
|
||||||
|
.then(() => {
|
||||||
|
this.displayQuote = true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.displayQuote = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -427,5 +427,17 @@
|
|||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
border: 1px solid var(--border, $fallback--border);
|
border: 1px solid var(--border, $fallback--border);
|
||||||
border-radius: var(--attachmentRadius, $fallback--attachmentRadius);
|
border-radius: var(--attachmentRadius, $fallback--attachmentRadius);
|
||||||
|
|
||||||
|
&.-unavailable-prompt {
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.display-quoted-status-button {
|
||||||
|
margin: 0.5em;
|
||||||
|
|
||||||
|
&-icon {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,13 +365,43 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<article
|
<article
|
||||||
v-if="quotedStatus"
|
v-if="hasVisibleQuote"
|
||||||
class="quoted-status"
|
class="quoted-status"
|
||||||
>
|
>
|
||||||
|
<button
|
||||||
|
class="button-unstyled -link display-quoted-status-button"
|
||||||
|
:aria-expanded="shouldDisplayQuote"
|
||||||
|
@click="toggleDisplayQuote"
|
||||||
|
>
|
||||||
|
{{ shouldDisplayQuote ? $t('status.hide_quote') : $t('status.display_quote') }}
|
||||||
|
<FAIcon
|
||||||
|
class="display-quoted-status-button-icon"
|
||||||
|
:icon="shouldDisplayQuote ? 'chevron-up' : 'chevron-down'"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
<Status
|
<Status
|
||||||
|
v-if="shouldDisplayQuote"
|
||||||
:statusoid="quotedStatus"
|
:statusoid="quotedStatus"
|
||||||
|
:in-quote="true"
|
||||||
/>
|
/>
|
||||||
</article>
|
</article>
|
||||||
|
<p
|
||||||
|
v-else-if="hasInvisibleQuote"
|
||||||
|
class="quoted-status -unavailable-prompt"
|
||||||
|
>
|
||||||
|
<i18n-t keypath="status.invisible_quote">
|
||||||
|
<template #link>
|
||||||
|
<bdi>
|
||||||
|
<a
|
||||||
|
:href="status.quote_url"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
{{ status.quote_url }}
|
||||||
|
</a>
|
||||||
|
</bdi>
|
||||||
|
</template>
|
||||||
|
</i18n-t>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="inConversation && !isPreview && replies && replies.length"
|
v-if="inConversation && !isPreview && replies && replies.length"
|
||||||
|
@ -1030,7 +1030,10 @@
|
|||||||
"show_all_conversation": "Show full conversation ({numStatus} other status) | Show full conversation ({numStatus} other statuses)",
|
"show_all_conversation": "Show full conversation ({numStatus} other status) | Show full conversation ({numStatus} other statuses)",
|
||||||
"show_only_conversation_under_this": "Only show replies to this status",
|
"show_only_conversation_under_this": "Only show replies to this status",
|
||||||
"status_history": "Status history",
|
"status_history": "Status history",
|
||||||
"reaction_count_label": "{num} person reacted | {num} people reacted"
|
"reaction_count_label": "{num} person reacted | {num} people reacted",
|
||||||
|
"hide_quote": "Hide the quoted status",
|
||||||
|
"display_quote": "Display the quoted status",
|
||||||
|
"invisible_quote": "Quoted status unavailable: {link}"
|
||||||
},
|
},
|
||||||
"user_card": {
|
"user_card": {
|
||||||
"approve": "Approve",
|
"approve": "Approve",
|
||||||
|
@ -326,7 +326,7 @@ export const parseStatus = (data) => {
|
|||||||
output.emoji_reactions = pleroma.emoji_reactions
|
output.emoji_reactions = pleroma.emoji_reactions
|
||||||
output.parent_visible = pleroma.parent_visible === undefined ? true : pleroma.parent_visible
|
output.parent_visible = pleroma.parent_visible === undefined ? true : pleroma.parent_visible
|
||||||
output.quote = pleroma.quote ? parseStatus(pleroma.quote) : undefined
|
output.quote = pleroma.quote ? parseStatus(pleroma.quote) : undefined
|
||||||
output.quote_id = output.quote ? output.quote.id : undefined
|
output.quote_id = pleroma.quote_id ? pleroma.quote_id : (output.quote ? output.quote.id : undefined)
|
||||||
output.quote_url = pleroma.quote_url
|
output.quote_url = pleroma.quote_url
|
||||||
output.quote_visible = pleroma.quote_visible
|
output.quote_visible = pleroma.quote_visible
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user