Skip to content
Merged
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
26 changes: 25 additions & 1 deletion src/components/MessagesList/MessagesGroup/Message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ the main body of the message as well as a quote.
@click.stop="handleReply">
{{ t('spreed', 'Reply') }}
</ActionButton>
<ActionButton
v-if="isPrivateReplyable"
icon="icon-user"
:close-after-click="true"
@click.stop="handlePrivateReply">
{{ t('spreed', 'Reply privately') }}
</ActionButton>
<template
v-for="action in messageActions">
<ActionButton
Expand Down Expand Up @@ -163,14 +170,15 @@ import Quote from '../../../Quote'
import participant from '../../../../mixins/participant'
import { EventBus } from '../../../../services/EventBus'
import emojiRegex from 'emoji-regex'
import { PARTICIPANT, CONVERSATION } from '../../../../constants'
import { PARTICIPANT, CONVERSATION, ATTENDEE } from '../../../../constants'
import moment from '@nextcloud/moment'
import {
showError,
showSuccess,
showWarning,
TOAST_DEFAULT_TIMEOUT,
} from '@nextcloud/dialogs'
import { createOneToOneConversation } from '../../../../services/conversationsService'

export default {
name: 'Message',
Expand Down Expand Up @@ -494,6 +502,15 @@ export default {
|| this.isMyMsg)
},

isPrivateReplyable() {
return this.isReplyable
&& (this.conversation.type === CONVERSATION.TYPE.PUBLIC
|| this.conversation.type === CONVERSATION.TYPE.GROUP)
&& !this.isMyMsg
&& this.actorType === ATTENDEE.ACTOR_TYPE.USERS
&& this.$store.getters.getActorType() === ATTENDEE.ACTOR_TYPE.USERS
},

messageActions() {
return this.$store.getters.messageActions
},
Expand Down Expand Up @@ -603,6 +620,13 @@ export default {
handleMouseleave() {
this.showActions = false
},
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}`))
},
},
}
</script>
Expand Down