diff --git a/src/components/chat/chat.js b/src/components/chat/chat.js index 8f8e279d..27713e30 100644 --- a/src/components/chat/chat.js +++ b/src/components/chat/chat.js @@ -325,11 +325,24 @@ const Chat = { }) this.fetchChat(true, chatId) }, - poster ({ status }) { - return this.backendInteractor.postChatMessage({ + poster (opts) { + const status = opts.status + + if (!status) { + // TODO: + return Promise.resolve({ error: this.$t('chats.empty_message_error') }) + } + + let params = { id: this.currentChat.id, content: status - }) + } + + if (opts.media && opts.media[0]) { + params.mediaId = opts.media[0].id + } + + return this.backendInteractor.postChatMessage(params) } } } diff --git a/src/components/chat/chat.vue b/src/components/chat/chat.vue index 108681a1..dd8d849e 100644 --- a/src/components/chat/chat.vue +++ b/src/components/chat/chat.vue @@ -76,7 +76,6 @@ :disable-subject="true" :disable-scope-selector="true" :disable-notice="true" - :disable-attachments="true" :disable-polls="true" :poster="poster" :preserve-focus="true" diff --git a/src/components/chat_message/chat_message.js b/src/components/chat_message/chat_message.js index 7e3cfad3..5354aa00 100644 --- a/src/components/chat_message/chat_message.js +++ b/src/components/chat_message/chat_message.js @@ -46,12 +46,19 @@ const ChatMessage = { return this.chatViewItem.type === 'message' }, messageForStatusContent () { - return { + let result = { summary: '', statusnet_html: this.message.content, - text: this.message.content, - attachments: [] + text: this.message.content } + + if (this.message.attachment) { + result.attachments = [this.message.attachment] + } else { + result.attachments = [] + } + + return result }, ...mapState({ betterShadow: state => state.interface.browserSupport.cssFilter, diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 27fd9db1..dcb6220d 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -36,7 +36,6 @@ const PostStatusForm = { 'disableScopeSelector', 'disableNotice', 'disablePolls', - 'disableAttachments', 'placeholder', 'maxHeight', 'poster', diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index bba79989..cc82f8f4 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -169,7 +169,6 @@ >