diff --git a/src/components/chat_message/chat_message.js b/src/components/chat_message/chat_message.js index a71e3ac46..678d44af4 100644 --- a/src/components/chat_message/chat_message.js +++ b/src/components/chat_message/chat_message.js @@ -1,20 +1,21 @@ import { mapState as mapPiniaState } from 'pinia' +import { defineAsyncComponent } from 'vue' import { mapState } from 'vuex' import Attachment from 'src/components/attachment/attachment.vue' -import MentionLink from 'src/components/mention_link/mention_link.vue' import ChatMessageDate from 'src/components/chat_message_date/chat_message_date.vue' +import EmojiReactions from 'src/components/emoji_reactions/emoji_reactions.vue' import Gallery from 'src/components/gallery/gallery.vue' import LinkPreview from 'src/components/link-preview/link-preview.vue' +import MentionLink from 'src/components/mention_link/mention_link.vue' import Popover from 'src/components/popover/popover.vue' import StatusActionButtons from 'src/components/status_action_buttons/status_action_buttons.vue' import StatusBody from 'src/components/status_body/status_body.vue' import StatusContent from 'src/components/status_content/status_content.vue' import StatusPopover from 'src/components/status_popover/status_popover.vue' +import Timeago from 'src/components/timeago/timeago.vue' import UserAvatar from 'src/components/user_avatar/user_avatar.vue' import UserPopover from 'src/components/user_popover/user_popover.vue' -import Timeago from 'src/components/timeago/timeago.vue' -import EmojiReactions from 'src/components/emoji_reactions/emoji_reactions.vue' import { useInstanceStore } from 'src/stores/instance.js' import { useInterfaceStore } from 'src/stores/interface' @@ -24,10 +25,10 @@ import { library } from '@fortawesome/fontawesome-svg-core' import { faCircleNotch, faEllipsisH, - faTimes, faReply, faRetweet, faStar, + faTimes, } from '@fortawesome/free-solid-svg-icons' library.add(faTimes, faEllipsisH, faCircleNotch, faReply, faStar, faRetweet) @@ -59,6 +60,7 @@ const ChatMessage = { UserPopover, StatusPopover, MentionLink, + Quote: defineAsyncComponent(() => import('src/components/quote/quote.vue')), Timeago, }, computed: { @@ -75,25 +77,24 @@ const ChatMessage = { return this.author.id === this.currentUser.id }, message() { - return this.isMessage ? this.chatItem.data : null + if (!this.isMessage) return null + return this.chatItem.data.retweeted_status ?? this.chatItem.data }, isMessage() { return this.chatItem.type === 'message' }, isCustomReply() { if (!this.previousItem) return false - if (!this.chatItem.data.in_reply_to_status_id) return false - return ( - this.previousItem.data.id !== this.chatItem.data.in_reply_to_status_id - ) + if (!this.message.in_reply_to_status_id) return false + return this.previousItem.data.id !== this.message.in_reply_to_status_id }, isBrokenReply() { if (!this.previousItem) return false - return !this.chatItem.data.in_reply_to_status_id + return !this.message.in_reply_to_status_id }, customReplyTo() { return this.$store.state.statuses.allStatusesObject[ - this.chatItem.data.in_reply_to_status_id + this.message.in_reply_to_status_id ] }, replyToName() { @@ -115,13 +116,22 @@ const ChatMessage = { return user ? user.statusnet_profile_url : 'NOT_FOUND' } }, + quoteId() { + return this.message.quote_id + }, + quoteUrl() { + return this.message.quote_url + }, + quoteVisible() { + return this.message.quote_visible + }, messageForStatusContent() { return { + ...this.message, summary: '', emojis: this.message.emojis, raw_html: this.message.content || this.message.raw_html || '', text: this.message.content || '', - attachments: this.message.attachments, } }, hasAttachment() { @@ -190,8 +200,8 @@ const ChatMessage = { const confirmed = window.confirm(this.$t('chats.delete_confirm')) if (confirmed) { await this.$emit('delete', { - messageId: this.chatItem.data.id, - chatId: this.chatItem.data.chat_id, + messageId: this.message.id, + chatId: this.message.chat_id, }) } this.hovered = false diff --git a/src/components/chat_message/chat_message.scss b/src/components/chat_message/chat_message.scss index 44dd01c30..becf1c0b0 100644 --- a/src/components/chat_message/chat_message.scss +++ b/src/components/chat_message/chat_message.scss @@ -15,6 +15,10 @@ min-width: 30em; } + .quoted-post { + margin-bottom: 1.5em; + } + .chat-message-toolbar { transition: opacity 0.1s; opacity: 0; diff --git a/src/components/chat_message/chat_message.vue b/src/components/chat_message/chat_message.vue index a12218008..1906444fe 100644 --- a/src/components/chat_message/chat_message.vue +++ b/src/components/chat_message/chat_message.vue @@ -146,6 +146,13 @@ >