feat: Add preview for attachment messages (#1562)

Add preview for pending messages and attachments

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Nithin David Thomas
2021-01-06 17:56:29 +05:30
committed by GitHub
parent db189e3c26
commit 3d2db95417
17 changed files with 434 additions and 250 deletions

View File

@@ -3,10 +3,7 @@ import * as types from '../../mutation-types';
import ConversationApi from '../../../api/inbox/conversation';
import MessageApi from '../../../api/inbox/message';
import { MESSAGE_STATUS, MESSAGE_TYPE } from 'shared/constants/messages';
import {
createPendingMessage,
createPendingAttachment,
} from 'dashboard/helper/commons';
import { createPendingMessage } from 'dashboard/helper/commons';
// actions
const actions = {
@@ -215,20 +212,6 @@ const actions = {
commit(types.default.SET_ACTIVE_INBOX, inboxId);
},
sendAttachment: async ({ commit }, data) => {
try {
const pendingMessage = createPendingAttachment(data);
commit(types.default.ADD_MESSAGE, pendingMessage);
const response = await MessageApi.sendAttachment([
...data,
pendingMessage.id,
]);
commit(types.default.ADD_MESSAGE, response.data);
} catch (error) {
// Handle error
}
},
muteConversation: async ({ commit }, conversationId) => {
try {
await ConversationApi.mute(conversationId);