Skip to content
Open
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
60 changes: 3 additions & 57 deletions src/components/LeftSidebar/ConversationsList/Conversation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,6 @@
</template>
{{ t('spreed', 'Leave conversation') }}
</NcActionButton>

<NcActionButton v-if="item.canDeleteConversation"
key="delete-conversation"
close-after-click
class="critical"
@click="isDeleteDialogOpen = true">
<template #icon>
<IconDelete :size="16" />
</template>
{{ t('spreed', 'Delete conversation') }}
</NcActionButton>
</template>
<template v-else-if="submenu === 'notifications'">
<NcActionButton :aria-label="t('spreed', 'Back')"
Expand Down Expand Up @@ -169,10 +158,9 @@
</NcActionButton>
</template>

<!-- confirmation required to leave / delete conversation -->
<template v-if="isLeaveDialogOpen || isDeleteDialogOpen" #extra>
<NcDialog v-if="isLeaveDialogOpen"
:open.sync="isLeaveDialogOpen"
<!-- confirmation required to leave conversation -->
<template v-if="isLeaveDialogOpen" #extra>
<NcDialog :open.sync="isLeaveDialogOpen"
:name="t('spreed', 'Leave conversation')">
<template #default>
<p>{{ dialogLeaveMessage }}</p>
Expand All @@ -192,19 +180,6 @@
</NcButton>
</template>
</NcDialog>
<NcDialog v-if="isDeleteDialogOpen"
:open.sync="isDeleteDialogOpen"
:name="t('spreed','Delete conversation')"
:message="dialogDeleteMessage">
<template #actions>
<NcButton type="tertiary" @click="isDeleteDialogOpen = false">
{{ t('spreed', 'No') }}
</NcButton>
<NcButton type="error" @click="deleteConversation">
{{ t('spreed', 'Yes') }}
</NcButton>
</template>
</NcDialog>
</template>
</NcListItem>
</template>
Expand All @@ -222,7 +197,6 @@ import IconArrowRight from 'vue-material-design-icons/ArrowRight.vue'
import IconBell from 'vue-material-design-icons/Bell.vue'
import IconCog from 'vue-material-design-icons/Cog.vue'
import IconContentCopy from 'vue-material-design-icons/ContentCopy.vue'
import IconDelete from 'vue-material-design-icons/Delete.vue'
import IconExitToApp from 'vue-material-design-icons/ExitToApp.vue'
import IconEye from 'vue-material-design-icons/Eye.vue'
import IconEyeOff from 'vue-material-design-icons/EyeOff.vue'
Expand Down Expand Up @@ -270,7 +244,6 @@ export default {
IconBell,
IconCog,
IconContentCopy,
IconDelete,
IconExitToApp,
IconEye,
IconEyeOff,
Expand Down Expand Up @@ -324,7 +297,6 @@ export default {
setup(props) {
const submenu = ref(null)
const isLeaveDialogOpen = ref(false)
const isDeleteDialogOpen = ref(false)
const { item, isSearchResult } = toRefs(props)
const { counterType, conversationInformation } = useConversationInfo({ item, isSearchResult })

Expand All @@ -333,7 +305,6 @@ export default {
supportsArchive,
submenu,
isLeaveDialogOpen,
isDeleteDialogOpen,
counterType,
conversationInformation,
notificationLevels,
Expand Down Expand Up @@ -367,13 +338,6 @@ export default {
})
},

dialogDeleteMessage() {
return t('spreed', 'Do you really want to delete "{displayName}"?', this.item, undefined, {
escape: false,
sanitize: false,
})
},

to() {
return this.item?.token
? { name: 'conversation', params: { token: this.item.token } }
Expand Down Expand Up @@ -428,24 +392,6 @@ export default {
emit('show-conversation-settings', { token: this.item.token })
},

/**
* Deletes the conversation.
*/
async deleteConversation() {
try {
this.isDeleteDialogOpen = false
if (this.isActive) {
await this.$store.dispatch('leaveConversation', { token: this.item.token })
await this.$router.push({ name: 'root' })
.catch((failure) => !isNavigationFailure(failure, NavigationFailureType.duplicated) && Promise.reject(failure))
}
await this.$store.dispatch('deleteConversationFromServer', { token: this.item.token })
} catch (error) {
console.error(`Error while deleting conversation ${error}`)
showError(t('spreed', 'Error while deleting conversation'))
}
},

/**
* Deletes the current user from the conversation.
*/
Expand Down