cleanup
This commit is contained in:
parent
cd44556750
commit
90a188f2c3
5 changed files with 5 additions and 17 deletions
|
@ -40,12 +40,11 @@ const ChatListItem = {
|
||||||
const message = this.chat.lastMessage
|
const message = this.chat.lastMessage
|
||||||
const messageEmojis = message ? message.emojis : []
|
const messageEmojis = message ? message.emojis : []
|
||||||
const isYou = message && message.account_id === this.currentUser.id
|
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
|
const messagePreview = isYou ? `<i>${this.$t('chats.you')}</i> ${content}` : content
|
||||||
return {
|
return {
|
||||||
summary: '',
|
summary: '',
|
||||||
emojis: messageEmojis,
|
emojis: messageEmojis,
|
||||||
statusnet_html: messagePreview,
|
|
||||||
raw_html: messagePreview,
|
raw_html: messagePreview,
|
||||||
text: messagePreview,
|
text: messagePreview,
|
||||||
attachments: []
|
attachments: []
|
||||||
|
|
|
@ -58,8 +58,7 @@ const ChatMessage = {
|
||||||
return {
|
return {
|
||||||
summary: '',
|
summary: '',
|
||||||
emojis: this.message.emojis,
|
emojis: this.message.emojis,
|
||||||
raw_html: this.message.content_raw,
|
raw_html: this.message.content,
|
||||||
statusnet_html: this.message.content,
|
|
||||||
text: this.message.content,
|
text: this.message.content,
|
||||||
attachments: this.message.attachments
|
attachments: this.message.attachments
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ const StatusContent = {
|
||||||
// Using max-height + overflow: auto for status components resulted in false positives
|
// Using max-height + overflow: auto for status components resulted in false positives
|
||||||
// very often with japanese characters, and it was very annoying.
|
// very often with japanese characters, and it was very annoying.
|
||||||
tallStatus () {
|
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
|
return lengthScore > 20
|
||||||
},
|
},
|
||||||
longSubject () {
|
longSubject () {
|
||||||
|
|
|
@ -267,7 +267,6 @@ export const parseStatus = (data) => {
|
||||||
output.type = data.reblog ? 'retweet' : 'status'
|
output.type = data.reblog ? 'retweet' : 'status'
|
||||||
output.nsfw = data.sensitive
|
output.nsfw = data.sensitive
|
||||||
|
|
||||||
output.statusnet_html = addEmojis(data.content, data.emojis)
|
|
||||||
output.raw_html = data.content
|
output.raw_html = data.content
|
||||||
output.emojis = data.emojis
|
output.emojis = data.emojis
|
||||||
|
|
||||||
|
@ -329,7 +328,7 @@ export const parseStatus = (data) => {
|
||||||
output.nsfw = data.nsfw
|
output.nsfw = data.nsfw
|
||||||
}
|
}
|
||||||
|
|
||||||
output.statusnet_html = data.statusnet_html
|
output.raw_html = data.statusnet_html
|
||||||
output.text = data.text
|
output.text = data.text
|
||||||
|
|
||||||
output.in_reply_to_status_id = data.in_reply_to_status_id
|
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.created_at = new Date(message.created_at)
|
||||||
output.chat_id = message.chat_id
|
output.chat_id = message.chat_id
|
||||||
output.emojis = message.emojis
|
output.emojis = message.emojis
|
||||||
output.content_raw = message.content
|
output.content = message.content
|
||||||
if (message.content) {
|
if (message.content) {
|
||||||
output.content = addEmojis(message.content, message.emojis)
|
output.content = addEmojis(message.content, message.emojis)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -23,7 +23,6 @@ const makeMockStatusQvitter = (overrides = {}) => {
|
||||||
repeat_num: 0,
|
repeat_num: 0,
|
||||||
repeated: false,
|
repeated: false,
|
||||||
statusnet_conversation_id: '16300488',
|
statusnet_conversation_id: '16300488',
|
||||||
statusnet_html: '<p>haha benis</p>',
|
|
||||||
summary: null,
|
summary: null,
|
||||||
tags: [],
|
tags: [],
|
||||||
text: 'haha benis',
|
text: 'haha benis',
|
||||||
|
@ -233,14 +232,6 @@ describe('API Entities normalizer', () => {
|
||||||
expect(parsedRepeat).to.have.deep.property('retweeted_status.id', 'deadbeef')
|
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', () => {
|
it('adds emojis to subject line', () => {
|
||||||
const post = makeMockStatusMasto({ emojis: makeMockEmojiMasto(), spoiler_text: 'CW: 300 IQ :thinking:' })
|
const post = makeMockStatusMasto({ emojis: makeMockEmojiMasto(), spoiler_text: 'CW: 300 IQ :thinking:' })
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue