Remove participants tab and collapse sidebar for one to one conversations

Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
This commit is contained in:
Marco Ambrosini 2021-06-18 13:37:26 +01:00
Родитель 74adda3a7c
Коммит b41176fc70
1 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -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()) {