From b41176fc7010655ac1615255d272a0ce7ffead64 Mon Sep 17 00:00:00 2001 From: Marco Ambrosini Date: Fri, 18 Jun 2021 13:37:26 +0100 Subject: [PATCH] Remove participants tab and collapse sidebar for one to one conversations Signed-off-by: Marco Ambrosini --- src/App.vue | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/App.vue b/src/App.vue index df1a5a1b7..442b79447 100644 --- a/src/App.vue +++ b/src/App.vue @@ -68,6 +68,7 @@ import ConversationSettingsDialog from './components/ConversationSettings/Conver import '@nextcloud/dialogs/styles/toast.scss' import { register } from 'extendable-media-recorder' import { connect } from 'extendable-media-recorder-wav-encoder' +import { CONVERSATION } from './constants' export default { name: 'App', @@ -176,6 +177,22 @@ export default { token() { return this.$store.getters.getToken() }, + + /** + * The current conversation + * @returns {object} The conversation object. + */ + currentConversation() { + return this.$store.getters.conversation(this.token) + }, + + /** + * Computes whether the current conversation is one to one + * @returns {boolean} The result + */ + isOneToOne() { + return this.currentConversation?.type === CONVERSATION.TYPE.ONE_TO_ONE + }, }, watch: { @@ -186,6 +203,15 @@ export default { this.setPageTitle(this.getConversationName(this.token), this.atLeastOneLastMessageIdChanged) }, + + token() { + // Collapse the sidebar if it's a 1to1 conversation + if (this.isOneToOne || BrowserStorage.getItem('sidebarOpen') === 'false') { + this.$store.dispatch('hideSidebar') + } else if (BrowserStorage.getItem('sidebarOpen') === 'true') { + this.$store.dispatch('showSidebar') + } + }, }, beforeDestroy() { @@ -317,6 +343,7 @@ export default { } else { beforeRouteChangeListener(to, from, next) } + }) if (getCurrentUser()) {