Merge branch 'chat-refactor' into shigusegubu-themes3
This commit is contained in:
commit
e428288f2f
6 changed files with 46 additions and 18 deletions
|
|
@ -1,20 +1,21 @@
|
||||||
import { mapState as mapPiniaState } from 'pinia'
|
import { mapState as mapPiniaState } from 'pinia'
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
import Attachment from 'src/components/attachment/attachment.vue'
|
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 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 Gallery from 'src/components/gallery/gallery.vue'
|
||||||
import LinkPreview from 'src/components/link-preview/link-preview.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 Popover from 'src/components/popover/popover.vue'
|
||||||
import StatusActionButtons from 'src/components/status_action_buttons/status_action_buttons.vue'
|
import StatusActionButtons from 'src/components/status_action_buttons/status_action_buttons.vue'
|
||||||
import StatusBody from 'src/components/status_body/status_body.vue'
|
import StatusBody from 'src/components/status_body/status_body.vue'
|
||||||
import StatusContent from 'src/components/status_content/status_content.vue'
|
import StatusContent from 'src/components/status_content/status_content.vue'
|
||||||
import StatusPopover from 'src/components/status_popover/status_popover.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 UserAvatar from 'src/components/user_avatar/user_avatar.vue'
|
||||||
import UserPopover from 'src/components/user_popover/user_popover.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 { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
|
|
@ -24,10 +25,10 @@ import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import {
|
import {
|
||||||
faCircleNotch,
|
faCircleNotch,
|
||||||
faEllipsisH,
|
faEllipsisH,
|
||||||
faTimes,
|
|
||||||
faReply,
|
faReply,
|
||||||
faRetweet,
|
faRetweet,
|
||||||
faStar,
|
faStar,
|
||||||
|
faTimes,
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
library.add(faTimes, faEllipsisH, faCircleNotch, faReply, faStar, faRetweet)
|
library.add(faTimes, faEllipsisH, faCircleNotch, faReply, faStar, faRetweet)
|
||||||
|
|
@ -59,6 +60,7 @@ const ChatMessage = {
|
||||||
UserPopover,
|
UserPopover,
|
||||||
StatusPopover,
|
StatusPopover,
|
||||||
MentionLink,
|
MentionLink,
|
||||||
|
Quote: defineAsyncComponent(() => import('src/components/quote/quote.vue')),
|
||||||
Timeago,
|
Timeago,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -75,25 +77,24 @@ const ChatMessage = {
|
||||||
return this.author.id === this.currentUser.id
|
return this.author.id === this.currentUser.id
|
||||||
},
|
},
|
||||||
message() {
|
message() {
|
||||||
return this.isMessage ? this.chatItem.data : null
|
if (!this.isMessage) return null
|
||||||
|
return this.chatItem.data.retweeted_status ?? this.chatItem.data
|
||||||
},
|
},
|
||||||
isMessage() {
|
isMessage() {
|
||||||
return this.chatItem.type === 'message'
|
return this.chatItem.type === 'message'
|
||||||
},
|
},
|
||||||
isCustomReply() {
|
isCustomReply() {
|
||||||
if (!this.previousItem) return false
|
if (!this.previousItem) return false
|
||||||
if (!this.chatItem.data.in_reply_to_status_id) return false
|
if (!this.message.in_reply_to_status_id) return false
|
||||||
return (
|
return this.previousItem.data.id !== this.message.in_reply_to_status_id
|
||||||
this.previousItem.data.id !== this.chatItem.data.in_reply_to_status_id
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
isBrokenReply() {
|
isBrokenReply() {
|
||||||
if (!this.previousItem) return false
|
if (!this.previousItem) return false
|
||||||
return !this.chatItem.data.in_reply_to_status_id
|
return !this.message.in_reply_to_status_id
|
||||||
},
|
},
|
||||||
customReplyTo() {
|
customReplyTo() {
|
||||||
return this.$store.state.statuses.allStatusesObject[
|
return this.$store.state.statuses.allStatusesObject[
|
||||||
this.chatItem.data.in_reply_to_status_id
|
this.message.in_reply_to_status_id
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
replyToName() {
|
replyToName() {
|
||||||
|
|
@ -115,13 +116,22 @@ const ChatMessage = {
|
||||||
return user ? user.statusnet_profile_url : 'NOT_FOUND'
|
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() {
|
messageForStatusContent() {
|
||||||
return {
|
return {
|
||||||
|
...this.message,
|
||||||
summary: '',
|
summary: '',
|
||||||
emojis: this.message.emojis,
|
emojis: this.message.emojis,
|
||||||
raw_html: this.message.content || this.message.raw_html || '',
|
raw_html: this.message.content || this.message.raw_html || '',
|
||||||
text: this.message.content || '',
|
text: this.message.content || '',
|
||||||
attachments: this.message.attachments,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hasAttachment() {
|
hasAttachment() {
|
||||||
|
|
@ -190,8 +200,8 @@ const ChatMessage = {
|
||||||
const confirmed = window.confirm(this.$t('chats.delete_confirm'))
|
const confirmed = window.confirm(this.$t('chats.delete_confirm'))
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
await this.$emit('delete', {
|
await this.$emit('delete', {
|
||||||
messageId: this.chatItem.data.id,
|
messageId: this.message.id,
|
||||||
chatId: this.chatItem.data.chat_id,
|
chatId: this.message.chat_id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.hovered = false
|
this.hovered = false
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@
|
||||||
min-width: 30em;
|
min-width: 30em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quoted-post {
|
||||||
|
margin-bottom: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
.chat-message-toolbar {
|
.chat-message-toolbar {
|
||||||
transition: opacity 0.1s;
|
transition: opacity 0.1s;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,13 @@
|
||||||
>
|
>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<EmojiReactions :status="message" />
|
<EmojiReactions :status="message" />
|
||||||
|
<Quote
|
||||||
|
class="quoted-post"
|
||||||
|
:status-id="quoteId"
|
||||||
|
:status-url="quoteUrl"
|
||||||
|
:status-visible="quoteVisible"
|
||||||
|
initially-expanded
|
||||||
|
/>
|
||||||
<span
|
<span
|
||||||
class="created-at"
|
class="created-at"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import ChatMessageList from 'src/components/chat_message_list/chat_message_list.
|
||||||
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
|
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
|
||||||
import QuickFilterSettings from 'src/components/quick_filter_settings/quick_filter_settings.vue'
|
import QuickFilterSettings from 'src/components/quick_filter_settings/quick_filter_settings.vue'
|
||||||
import QuickViewSettings from 'src/components/quick_view_settings/quick_view_settings.vue'
|
import QuickViewSettings from 'src/components/quick_view_settings/quick_view_settings.vue'
|
||||||
import ThreadTree from 'src/components/thread_tree/thread_tree.vue'
|
|
||||||
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
||||||
|
import ThreadTree from 'src/components/thread_tree/thread_tree.vue'
|
||||||
|
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
|
|
@ -635,6 +635,12 @@ const conversation = {
|
||||||
this.unsuspendibleIds.delete(id)
|
this.unsuspendibleIds.delete(id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onPosted(data) {
|
||||||
|
this.explicitReplyStatus = null
|
||||||
|
if (this.isPage) {
|
||||||
|
this.$router.push({ name: 'conversation', params: { id: data.id } })
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,7 @@
|
||||||
disable-quotes
|
disable-quotes
|
||||||
mentions-line
|
mentions-line
|
||||||
mentions-line-read-only
|
mentions-line-read-only
|
||||||
|
@posted="onPosted"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import { mapState } from 'pinia'
|
import { mapState } from 'pinia'
|
||||||
|
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
|
||||||
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
||||||
|
|
||||||
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import {
|
import {
|
||||||
faFile,
|
faFile,
|
||||||
|
|
@ -53,7 +54,7 @@ const StatusBody = {
|
||||||
// to indicate what post reply belongs to
|
// to indicate what post reply belongs to
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -150,7 +151,6 @@ const StatusBody = {
|
||||||
},
|
},
|
||||||
...mapState(useMergedConfigStore, ['mergedConfig']),
|
...mapState(useMergedConfigStore, ['mergedConfig']),
|
||||||
},
|
},
|
||||||
components: {},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.status.attentions &&
|
this.status.attentions &&
|
||||||
this.status.attentions.forEach((attn) => {
|
this.status.attentions.forEach((attn) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue