diff --git a/src/api/chats.js b/src/api/chats.js index 51e83c74f..8f93ad57f 100644 --- a/src/api/chats.js +++ b/src/api/chats.js @@ -1,6 +1,6 @@ import { paramsString, promisedRequest } from './helpers.js' -import { parseChat } from 'src/services/entity_normalizer/entity_normalizer.service.js' +import { parseChat, parseChatMessage } from 'src/services/entity_normalizer/entity_normalizer.service.js' const PLEROMA_CHATS_URL = '/api/v1/pleroma/chats' const PLEROMA_CHAT_URL = (id) => `/api/v1/pleroma/chats/by-account-id/${id}` @@ -15,7 +15,7 @@ export const chats = ({ credentials }) => url: PLEROMA_CHATS_URL, credentials, }).then(({ data }) => ({ - chatList: data.map(parseChat).filter((c) => c), + data: data.map(parseChat).filter((c) => c), })) export const getOrCreateChat = ({ accountId, credentials }) => @@ -23,7 +23,7 @@ export const getOrCreateChat = ({ accountId, credentials }) => url: PLEROMA_CHAT_URL(accountId), method: 'POST', credentials, - }) + }).then(({ data }) => ({ data: parseChat(data) })) export const chatMessages = ({ id, @@ -36,7 +36,9 @@ export const chatMessages = ({ url: PLEROMA_CHAT_MESSAGES_URL(id, { maxId, sinceId, limit }), method: 'GET', credentials, - }) + }).then(({ data }) => ({ + data: data.map(parseChatMessage).filter((c) => c), + })) } export const sendChatMessage = ({ @@ -66,7 +68,9 @@ export const sendChatMessage = ({ payload, credentials, headers, - }) + }).then(({ data }) => ({ + data: parseChatMessage(data), + })) } export const readChat = ({ id, lastReadId, credentials }) => diff --git a/src/components/chat_message/chat_message.js b/src/components/chat_message/chat_message.js index c35e189dd..c75f09d11 100644 --- a/src/components/chat_message/chat_message.js +++ b/src/components/chat_message/chat_message.js @@ -15,18 +15,13 @@ import { useInterfaceStore } from 'src/stores/interface' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { library } from '@fortawesome/fontawesome-svg-core' -import { faEllipsisH, faTimes } from '@fortawesome/free-solid-svg-icons' +import { faEllipsisH, faTimes, faCircleNotch } from '@fortawesome/free-solid-svg-icons' -library.add(faTimes, faEllipsisH) +library.add(faTimes, faEllipsisH, faCircleNotch) const ChatMessage = { name: 'ChatMessage', - props: [ - 'edited', - 'noHeading', - 'chatItem', - 'hoveredMessageChain', - ], + props: ['edited', 'noHeading', 'chatItem', 'hoveredMessageChain'], emits: ['hover'], components: { Popover, diff --git a/src/components/chat_message/chat_message.scss b/src/components/chat_message/chat_message.scss index c058f8172..4fcb81c33 100644 --- a/src/components/chat_message/chat_message.scss +++ b/src/components/chat_message/chat_message.scss @@ -104,7 +104,7 @@ width: 100%; } - .outgoing { + .-outgoing { display: flex; flex-flow: row wrap; place-content: end flex-end; @@ -118,12 +118,16 @@ } } - .incoming { + .-incoming { .chat-message-menu { left: 0.4rem; } } + .-pending { + color: red !important; + } + .chat-message-inner.with-media { width: 100%; diff --git a/src/components/chat_message/chat_message.vue b/src/components/chat_message/chat_message.vue index 6ac8a4266..feb236955 100644 --- a/src/components/chat_message/chat_message.vue +++ b/src/components/chat_message/chat_message.vue @@ -8,7 +8,7 @@ >