Browse Source

Merge pull request #5799 from nextcloud/enh/noid/simplify-sidebar-in-one-to-one-conversations

Enh/noid/simplify sidebar in one to one conversations
pull/5964/head
Vincent Petry 5 years ago
committed by GitHub
parent
commit
7a8df94550
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      src/App.vue
  2. 8
      src/components/RightSidebar/RightSidebar.vue

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

8
src/components/RightSidebar/RightSidebar.vue

@ -47,7 +47,7 @@
icon="icon-comment">
<ChatView :is-visible="opened" />
</AppSidebarTab>
<AppSidebarTab v-if="getUserId"
<AppSidebarTab v-if="getUserId && !isOneToOne"
id="participants"
ref="participantsTab"
:order="2"
@ -179,7 +179,7 @@ export default {
},
canModerate() {
return this.conversation.type !== CONVERSATION.TYPE.ONE_TO_ONE && (this.canFullModerate || this.participantType === PARTICIPANT.TYPE.GUEST_MODERATOR)
return !this.isOneToOne && (this.canFullModerate || this.participantType === PARTICIPANT.TYPE.GUEST_MODERATOR)
},
/**
@ -207,6 +207,10 @@ export default {
return this.conversation.lobbyState === WEBINAR.LOBBY.NON_MODERATORS
},
isOneToOne() {
return this.conversation.type === CONVERSATION.TYPE.ONE_TO_ONE
},
},
watch: {

Loading…
Cancel
Save