aboutsummaryrefslogtreecommitdiff
path: root/src/components/status_body
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2021-06-11 03:11:58 +0300
committerHenry Jameson <me@hjkos.com>2021-06-11 03:11:58 +0300
commitf883d2f75cd3c404115bd2c98b6d3c8d7ff10ef6 (patch)
tree1cfb6499bc5ffc5eb246fb1b270191926681b414 /src/components/status_body
parentb84aeff6bf288b6e5855c2be0fd78577a0f7c0e5 (diff)
better handling of hellthreads with mentions at bottom
Diffstat (limited to 'src/components/status_body')
-rw-r--r--src/components/status_body/status_body.js24
-rw-r--r--src/components/status_body/status_body.vue13
2 files changed, 17 insertions, 20 deletions
diff --git a/src/components/status_body/status_body.js b/src/components/status_body/status_body.js
index 2fc9abbf..7433619b 100644
--- a/src/components/status_body/status_body.js
+++ b/src/components/status_body/status_body.js
@@ -3,6 +3,7 @@ import RichContent, { getHeadTailLinks } from 'src/components/rich_content/rich_
import MentionsLine from 'src/components/mentions_line/mentions_line.vue'
import { mapGetters } from 'vuex'
import { library } from '@fortawesome/fontawesome-svg-core'
+import { set } from 'vue'
import {
faFile,
faMusic,
@@ -27,11 +28,7 @@ const StatusContent = {
'noHeading',
'fullContent',
'singleLine',
- // if this was computed at upper level it can be passed here, otherwise
- // it will be in this component
- 'headTailLinks',
- 'hideFirstMentions',
- 'hideLastMentions'
+ 'hideMentions'
],
data () {
return {
@@ -39,9 +36,9 @@ const StatusContent = {
showingLongSubject: false,
// not as computed because it sets the initial state which will be changed later
expandingSubject: !this.$store.getters.mergedConfig.collapseMessageWithSubject,
- headTailLinksComputed: this.headTailLinks
- ? this.headTailLinks
- : getHeadTailLinks(this.status.raw_html)
+ headTailLinks: null,
+ firstMentions: [],
+ lastMentions: []
}
},
computed: {
@@ -81,12 +78,6 @@ const StatusContent = {
attachmentTypes () {
return this.status.attachments.map(file => fileType.fileType(file.mimetype))
},
- mentionsFirst () {
- return this.headTailLinksComputed.firstMentions
- },
- mentionsLast () {
- return this.headTailLinksComputed.lastMentions
- },
...mapGetters(['mergedConfig'])
},
components: {
@@ -107,6 +98,11 @@ const StatusContent = {
this.expandingSubject = !this.expandingSubject
}
},
+ setHeadTailLinks (headTailLinks) {
+ set(this, 'headTailLinks', headTailLinks)
+ set(this, 'firstMentions', headTailLinks.firstMentions)
+ set(this, 'lastMentions', headTailLinks.lastMentions)
+ },
generateTagLink (tag) {
return `/tag/${tag}`
}
diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue
index bd599a8c..68f6701f 100644
--- a/src/components/status_body/status_body.vue
+++ b/src/components/status_body/status_body.vue
@@ -48,20 +48,21 @@
:html="status.raw_html"
:emoji="status.emojis"
:handle-links="true"
+ :hide-mentions="hideMentions"
:greentext="mergedConfig.greentext"
- :hide-first-mentions="hideFirstMentions"
- :hide-last-mentions="hideLastMentions"
+ @parseReady="setHeadTailLinks"
+ ref="text"
>
<template v-slot:prefix>
<MentionsLine
- v-if="!hideFirstMentions && mentionsFirst"
- :mentions="mentionsFirst"
+ v-if="!hideMentions && firstMentions && firstMentions.length > 0"
+ :mentions="firstMentions"
/>
</template>
<template v-slot:suffix>
<MentionsLine
- v-if="!hideFirstMentions && mentionsLast"
- :mentions="mentionsLast"
+ v-if="!hideMentions && lastMentions.length > 0 && firstMentions.length === 0"
+ :mentions="lastMentions"
/>
</template>
</RichContent>