Skip to content

Commit

Permalink
fix(session): Fix setting a guest name
Browse files Browse the repository at this point in the history
Fixes: #4252

Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- committed Mar 12, 2024
1 parent 301822e commit 1d067b7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/Editor/GuestNameDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ export default {
},
},
beforeMount() {
this.guestName = this.$syncService.session.guestName
this.guestName = this.$syncService.connection.session.guestName
this.updateBufferedGuestName()
},
methods: {
setGuestName() {
const previousGuestName = this.$syncService.session.guestName
const previousGuestName = this.$syncService.connection.session.guestName
this.$syncService.updateSession(this.guestName).then(() => {
localStorage.setItem('nick', this.guestName)
this.updateBufferedGuestName()
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/SessionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default {
},
},
participantsPopover() {
if (this.currentSession.guestName) {
if (this.currentSession?.guestName) {
return this.participantsWithoutCurrent
}
return this.participants
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<p slot="lastSaved" class="last-saved">
{{ t('text', 'Last saved') }}: {{ lastSavedString }}
</p>
<GuestNameDialog v-if="$isPublic && !currentSession.userId" :session="currentSession" />
<GuestNameDialog v-if="$isPublic && currentSession && !currentSession.userId" :session="currentSession" />
</SessionList>
</div>
</template>
Expand Down
1 change: 1 addition & 0 deletions src/services/SessionApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class Connection {
this.#content = content
this.#documentState = documentState
this.#options = options
this.isPublic = !!options.shareToken
this.closed = false
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class SyncService {

updateSession(guestName) {
if (!this.connection.isPublic) {
return
return Promise.reject(new Error())
}
return this.connection.update(guestName)
.catch((error) => {
Expand Down

0 comments on commit 1d067b7

Please sign in to comment.