This commit is contained in:
Henry Jameson 2021-06-12 19:54:03 +03:00
parent cd44556750
commit 90a188f2c3
5 changed files with 5 additions and 17 deletions

View File

@ -40,12 +40,11 @@ const ChatListItem = {
const message = this.chat.lastMessage
const messageEmojis = message ? message.emojis : []
const isYou = message && message.account_id === this.currentUser.id
const content = message ? (this.attachmentInfo || message.content_raw) : ''
const content = message ? (this.attachmentInfo || message.content) : ''
const messagePreview = isYou ? `<i>${this.$t('chats.you')}</i> ${content}` : content
return {
summary: '',
emojis: messageEmojis,
statusnet_html: messagePreview,
raw_html: messagePreview,
text: messagePreview,
attachments: []

View File

@ -58,8 +58,7 @@ const ChatMessage = {
return {
summary: '',
emojis: this.message.emojis,
raw_html: this.message.content_raw,
statusnet_html: this.message.content,
raw_html: this.message.content,
text: this.message.content,
attachments: this.message.attachments
}

View File

@ -53,7 +53,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.statusnet_html.split(/<p|<br/).length + this.status.text.length / 80
const lengthScore = this.status.raw_html.split(/<p|<br/).length + this.status.text.length / 80
return lengthScore > 20
},
longSubject () {

View File

@ -267,7 +267,6 @@ export const parseStatus = (data) => {
output.type = data.reblog ? 'retweet' : 'status'
output.nsfw = data.sensitive
output.statusnet_html = addEmojis(data.content, data.emojis)
output.raw_html = data.content
output.emojis = data.emojis
@ -329,7 +328,7 @@ export const parseStatus = (data) => {
output.nsfw = data.nsfw
}
output.statusnet_html = data.statusnet_html
output.raw_html = data.statusnet_html
output.text = data.text
output.in_reply_to_status_id = data.in_reply_to_status_id
@ -449,7 +448,7 @@ export const parseChatMessage = (message) => {
output.created_at = new Date(message.created_at)
output.chat_id = message.chat_id
output.emojis = message.emojis
output.content_raw = message.content
output.content = message.content
if (message.content) {
output.content = addEmojis(message.content, message.emojis)
} else {

View File

@ -23,7 +23,6 @@ const makeMockStatusQvitter = (overrides = {}) => {
repeat_num: 0,
repeated: false,
statusnet_conversation_id: '16300488',
statusnet_html: '<p>haha benis</p>',
summary: null,
tags: [],
text: 'haha benis',
@ -233,14 +232,6 @@ describe('API Entities normalizer', () => {
expect(parsedRepeat).to.have.deep.property('retweeted_status.id', 'deadbeef')
})
it('adds emojis to post content', () => {
const post = makeMockStatusMasto({ emojis: makeMockEmojiMasto(), content: 'Makes you think :thinking:' })
const parsedPost = parseStatus(post)
expect(parsedPost).to.have.property('statusnet_html').that.contains('<img')
})
it('adds emojis to subject line', () => {
const post = makeMockStatusMasto({ emojis: makeMockEmojiMasto(), spoiler_text: 'CW: 300 IQ :thinking:' })