aboutsummaryrefslogtreecommitdiff
path: root/src/components/status_body
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2021-08-15 16:27:41 +0300
committerHenry Jameson <me@hjkos.com>2021-08-15 16:27:41 +0300
commit17d2eed06a7c0c2a38129e36cca1e676c351abce (patch)
tree2521a727071db6f7cfe4e76f7e227dfe69b750d6 /src/components/status_body
parentb67db47c888dd45c49a49b82e7922c2bf40ed61c (diff)
parentf16658adfc897a3b07ed7f79d872acd2c3837cc8 (diff)
Merge branch 'better-still-emoji' into proper-attachments
* better-still-emoji: fix tests prevent infinite update loops remove obsolete tests removed useless code, review change, fixed bug with tall statuses fixed mentions line again remove old emoji added, everything emoji-bearing uses RichContent now richcontent support in polls, user cards and user profiles support richcontent in polls fix tests, add performance test (skipped, doesn't assert anything), tweak max mentions count made the code responsible for showing unwritten mentions actually work remove new options for style and separate line, now groups all chained mentions on a mentionsline regardless of placement. fixes spacing fix tests
Diffstat (limited to 'src/components/status_body')
-rw-r--r--src/components/status_body/status_body.js22
-rw-r--r--src/components/status_body/status_body.vue1
2 files changed, 17 insertions, 6 deletions
diff --git a/src/components/status_body/status_body.js b/src/components/status_body/status_body.js
index 7ee965d9..f4167ac1 100644
--- a/src/components/status_body/status_body.js
+++ b/src/components/status_body/status_body.js
@@ -26,15 +26,16 @@ const StatusContent = {
'focused',
'noHeading',
'fullContent',
- 'singleLine',
- 'hideMentions'
+ 'singleLine'
],
data () {
return {
showingTall: this.fullContent || (this.inConversation && this.focused),
showingLongSubject: false,
// not as computed because it sets the initial state which will be changed later
- expandingSubject: !this.$store.getters.mergedConfig.collapseMessageWithSubject
+ expandingSubject: !this.$store.getters.mergedConfig.collapseMessageWithSubject,
+ postLength: this.status.text.length,
+ parseReadyDone: false
}
},
computed: {
@@ -49,7 +50,7 @@ const StatusContent = {
// Using max-height + overflow: auto for status components resulted in false positives
// very often with japanese characters, and it was very annoying.
tallStatus () {
- const lengthScore = this.status.raw_html.split(/<p|<br/).length + this.status.text.length / 80
+ const lengthScore = this.status.raw_html.split(/<p|<br/).length + this.postLength / 80
return lengthScore > 20
},
longSubject () {
@@ -87,8 +88,10 @@ const StatusContent = {
},
methods: {
onParseReady (event) {
+ if (this.parseReadyDone) return
+ this.parseReadyDone = true
this.$emit('parseReady', event)
- const { writtenMentions } = event
+ const { writtenMentions, invisibleMentions } = event
writtenMentions
.filter(mention => !mention.notifying)
.forEach(mention => {
@@ -99,6 +102,15 @@ const StatusContent = {
const host = url.replace(/^https?:\/\//, '').replace(/\/.+?$/, '')
this.$store.dispatch('fetchUserIfMissing', `${handle}@${host}`)
})
+ /* This is a bit of a hack to make current tall status detector work
+ * with rich mentions. Invisible mentions are detected at RichContent level
+ * and also we generate plaintext version of mentions by stripping tags
+ * so here we subtract from post length by each mention that became invisible
+ * via MentionsLine
+ */
+ this.postLength = invisibleMentions.reduce((acc, mention) => {
+ return acc - mention.textContent.length - 1
+ }, this.postLength)
},
toggleShowMore () {
if (this.mightHideBecauseTall) {
diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue
index 1001508c..a088e6bc 100644
--- a/src/components/status_body/status_body.vue
+++ b/src/components/status_body/status_body.vue
@@ -48,7 +48,6 @@
:html="status.raw_html"
:emoji="status.emojis"
:handle-links="true"
- :hide-mentions="hideMentions"
:greentext="mergedConfig.greentext"
:attentions="status.attentions"
@parseReady="onParseReady"