diff --git a/src/components/ConversationSettings/ConversationSettingsDialog.vue b/src/components/ConversationSettings/ConversationSettingsDialog.vue index ed844714b58..18656642f72 100644 --- a/src/components/ConversationSettings/ConversationSettingsDialog.vue +++ b/src/components/ConversationSettings/ConversationSettingsDialog.vue @@ -26,49 +26,61 @@ :open.sync="showSettings" :show-navigation="true" container="#content-vue"> + + + + + + :title="t('spreed', 'Chat notifications')"> + + :title="t('spreed', 'Guests access')"> + + :title="t('spreed', 'Conversation settings')"> + + :title="t('spreed', 'Meeting settings')"> + :title="t('spreed', 'Matterbridge')"> + + :title="t('spreed', 'Danger zone')"> import { subscribe, unsubscribe } from '@nextcloud/event-bus' -import { PARTICIPANT } from '../../constants' +import { PARTICIPANT, CONVERSATION } from '../../constants' import AppSettingsDialog from '@nextcloud/vue/dist/Components/AppSettingsDialog' import AppSettingsSection from '@nextcloud/vue/dist/Components/AppSettingsSection' import LinkShareSettings from './LinkShareSettings' @@ -91,6 +103,8 @@ import MatterbridgeSettings from './Matterbridge/MatterbridgeSettings' import { loadState } from '@nextcloud/initial-state' import DangerZone from './DangerZone' import NotificationsSettings from './NotificationsSettings' +import { showError } from '@nextcloud/dialogs' +import Description from '../Description/Description' export default { name: 'ConversationSettingsDialog', @@ -106,12 +120,16 @@ export default { MatterbridgeSettings, DangerZone, NotificationsSettings, + Description, }, data() { return { showSettings: false, matterbridgeEnabled: loadState('spreed', 'enable_matterbridge'), + isEditingDescription: false, + isDescriptionLoading: false, + } }, @@ -143,6 +161,18 @@ export default { canLeaveConversation() { return this.conversation.canLeaveConversation }, + + description() { + return this.conversation.description + }, + + showDescription() { + if (this.canFullModerate) { + return this.conversation.type !== CONVERSATION.TYPE.ONE_TO_ONE + } else { + return this.description !== '' + } + }, }, mounted() { @@ -166,6 +196,25 @@ export default { unsubscribe('show-conversation-settings', this.handleShowSettings) unsubscribe('hide-conversation-settings', this.handleHideSettings) }, + + async handleUpdateDescription(description) { + this.isDescriptionLoading = true + try { + await this.$store.dispatch('setConversationDescription', { + token: this.token, + description, + }) + this.isEditingDescription = false + } catch (error) { + console.error('Error while setting conversation description', error) + showError(t('spreed', 'Error while updating conversation description')) + } + this.isDescriptionLoading = false + }, + + handleEditDescription(payload) { + this.isEditingDescription = payload + }, }, } diff --git a/src/components/RightSidebar/Description/Description.vue b/src/components/Description/Description.vue similarity index 81% rename from src/components/RightSidebar/Description/Description.vue rename to src/components/Description/Description.vue index 2bf033724fa..7c3e870898c 100644 --- a/src/components/RightSidebar/Description/Description.vue +++ b/src/components/Description/Description.vue @@ -24,7 +24,7 @@ :key="forceReRenderKey" v-mousedown-outside="handleMouseDownOutside" class="description" - :class="{'description--editing': editing, 'description--expanded': expanded}"> + :class="{'description--editing': editing}">
- -
@@ -92,7 +82,6 @@ import Pencil from 'vue-material-design-icons/Pencil' import Check from 'vue-material-design-icons/Check' import Close from 'vue-material-design-icons/Close' -import ChevronDown from 'vue-material-design-icons/ChevronDown' import RichContentEditable from '@nextcloud/vue/dist/Components/RichContenteditable' import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip' @@ -103,7 +92,6 @@ export default { Check, Close, RichContentEditable, - ChevronDown, }, directives: { @@ -172,7 +160,6 @@ export default { return { descriptionText: this.description, forceReRenderKey: 0, - expanded: false, overflows: null, } }, @@ -201,27 +188,12 @@ export default { charactersCount: this.charactersCount, }) }, - - showCollapseButton() { - return this.overflows && !this.editing && !this.loading && this.expanded - }, - - showOverlay() { - return this.overflows && !this.editing && !this.loading && !this.expanded - }, - }, - - mounted() { - this.checkOverflow() }, watch: { // Each time the prop changes, reflect the changes in the value stored in this component description(newValue) { this.descriptionText = newValue - if (!this.editing) { - this.checkOverflow() - } }, editing(newValue) { if (!newValue) { @@ -229,11 +201,6 @@ export default { } }, }, - updated() { - if (!this.editing && !this.expanded) { - this.checkOverflow() - } - }, methods: { handleEditDescription() { @@ -269,18 +236,8 @@ export default { window.getSelection().removeAllRanges() }, - // Expand the description - handleClick() { - if (this.editing || this.loading) { - return - } if (this.overflows) { - this.expanded = !this.expanded - } - }, - // Collapse the description or dismiss editing handleMouseDownOutside(event) { - this.expanded = false this.$emit('update:editing', false) }, @@ -295,27 +252,23 @@ export default {