Skip to content

Commit

Permalink
fix: listen to dialog triggers from URL hash only when conversation i…
Browse files Browse the repository at this point in the history
…s open

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Oct 29, 2024
1 parent b751e6a commit 1458a59
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,6 @@ export default {
} else if (to.name === 'notfound') {
this.setPageTitle('')
}

if (to.hash === '#direct-call') {
emit('talk:media-settings:show')
}
})

if (getCurrentUser()) {
Expand All @@ -502,10 +498,6 @@ export default {
})
}

if (this.$route.hash === '#direct-call') {
emit('talk:media-settings:show')
}

subscribe('notifications:action:execute', this.interceptNotificationActions)
subscribe('notifications:notification:received', this.interceptNotificationReceived)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,9 @@ export default {
}
},

mounted() {
beforeMount() {
subscribe('show-conversation-settings', this.handleShowSettings)
subscribe('hide-conversation-settings', this.handleHideSettings)

},

beforeDestroy() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MediaSettings/MediaSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export default {
},
},

mounted() {
beforeMount() {
subscribe('talk:media-settings:show', this.showModal)
subscribe('talk:media-settings:hide', this.closeModalAndApplySettings)

Expand Down
17 changes: 17 additions & 0 deletions src/views/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
</template>

<script>
import { emit } from '@nextcloud/event-bus'

import CallView from '../components/CallView/CallView.vue'
import ChatView from '../components/ChatView.vue'
import LobbyScreen from '../components/LobbyScreen.vue'
import PollViewer from '../components/PollViewer/PollViewer.vue'
import TopBar from '../components/TopBar/TopBar.vue'

import { useIsInCall } from '../composables/useIsInCall.js'
import Router from '../router/router.js'

export default {
name: 'MainView',
Expand Down Expand Up @@ -68,6 +71,20 @@ export default {
},
},

mounted() {
const handleRouteHashChange = (token, route) => {
if (route?.hash === '#direct-call') {
emit('talk:media-settings:show')
Router.replace({ ...route, hash: '' })
} else if (route?.hash === '#settings') {
emit('show-conversation-settings', { token })
Router.replace({ ...route, hash: '' })
}
}

handleRouteHashChange(this.token, Router.currentRoute)
Router.afterEach((to) => handleRouteHashChange(this.token, to))
},
}
</script>

Expand Down

0 comments on commit 1458a59

Please sign in to comment.