Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions src/components/MessagesList/MessagesGroup/Message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@ the main body of the message as well as a quote.
v-if="isReplyable"
icon="icon-reply"
:close-after-click="true"
@click.stop="handleReply">
@click.stop="handleReply(token)">
{{ t('spreed', 'Reply') }}
</ActionButton>
<ActionButton
v-if="isReplyable"
icon="icon-user"
:close-after-click="true"
@click.stop="handlePrivateReply">
{{ t('spreed', 'Reply private') }}
</ActionButton>
</Actions>
</div>
</div>
Expand All @@ -88,6 +95,8 @@ import { EventBus } from '../../../../services/EventBus'
import emojiRegex from 'emoji-regex'
import { PARTICIPANT, CONVERSATION } from '../../../../constants'
import moment from '@nextcloud/moment'
import { createOneToOneConversation } from '../../../../services/conversationsService'
import createTemporaryMessage from '../../../../utils/temporaryMessage'

export default {
name: 'Message',
Expand Down Expand Up @@ -184,6 +193,13 @@ export default {
type: Boolean,
required: true,
},
/**
* Specifies if the message can be private replied to.
*/
isPrivateReplyable: {
type: Boolean,
required: true,
},
/**
* The conversation token.
*/
Expand Down Expand Up @@ -339,7 +355,7 @@ export default {
},

methods: {
handleReply() {
handleReply(t) {
this.$store.dispatch('addMessageToBeReplied', {
id: this.id,
actorId: this.actorId,
Expand All @@ -350,10 +366,22 @@ export default {
messageType: this.messageType,
message: this.message,
messageParameters: this.messageParameters,
token: this.token,
token: t,
})
EventBus.$emit('focusChatInput')
},
async handlePrivateReply() {
// open the 1:1 conversation
const response = await createOneToOneConversation(this.actorId)
const conversation = response.data.ocs.data
this.$store.dispatch('addConversation', conversation)
this.$router.push({ name: 'conversation', params: { token: conversation.token } }).catch(err => console.debug(`Error while pushing the new conversation's route: ${err}`))

// quoted message
const temporaryMessage = createTemporaryMessage('> 123', conversation.token)
this.$store.dispatch('addTemporaryMessage', temporaryMessage)

},
handleDelete() {
this.$store.dispatch('deleteMessage', this.message)
},
Expand Down