Skip to content

Commit

Permalink
Merge pull request #4442 from nextcloud/backport/4374/stable20
Browse files Browse the repository at this point in the history
[stable20] Only show the conflict warning when the session was in a call
  • Loading branch information
nickvergessen committed Oct 23, 2020
2 parents 4a1090d + 3b5386e commit 6aef7f5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1229,8 +1229,8 @@ public function joinRoom(string $token, string $password = '', bool $force = tru
}

if ($previousSession instanceof Participant && $previousSession->getSessionId() !== '0') {
// Previous session was active
if ($force === false) {
if ($force === false && $previousSession->getInCallFlags() !== Participant::FLAG_DISCONNECTED) {
// Previous session was active in the call, show a warning
return new DataResponse([
'sessionId' => $previousSession->getSessionId(),
'inCall' => $previousSession->getInCallFlags(),
Expand Down
10 changes: 9 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,11 @@ export default {
this.$store.dispatch('setWindowVisibility', !document.hidden)
if (this.windowIsVisible) {
// Remove the potential "*" marker for unread chat messages
this.setPageTitle(this.getConversationName(this.token), false)
let title = this.getConversationName(this.token)
if (window.document.title.indexOf(t('spreed', 'Duplicate session')) === 0) {
title = t('spreed', 'Duplicate session')
}
this.setPageTitle(title, false)
} else {
// Copy the last message map to the saved version,
// this will be our reference to check if any chat got a new
Expand All @@ -388,6 +392,10 @@ export default {
// On the first load we store the current page title "Talk - Nextcloud",
// so we can append it every time again
this.defaultPageTitle = window.document.title
// Coming from a "Duplicate session - Talk - …" page?
if (this.defaultPageTitle.indexOf(' - ' + t('spreed', 'Talk') + ' - ') !== -1) {
this.defaultPageTitle = this.defaultPageTitle.substring(this.defaultPageTitle.indexOf(' - ' + t('spreed', 'Talk') + ' - ') + 3)
}
// When a conversation is opened directly, the "Talk - " part is
// missing from the title
if (this.defaultPageTitle.indexOf(t('spreed', 'Talk') + ' - ') !== 0) {
Expand Down
10 changes: 10 additions & 0 deletions src/views/SessionConflictView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,15 @@
<script>
export default {
name: 'SessionConflictView',
mounted() {
this.setPageTitle()
},
methods: {
setPageTitle() {
window.document.title = t('spreed', 'Duplicate session') + ' - ' + window.document.title
},
},
}
</script>

0 comments on commit 6aef7f5

Please sign in to comment.