From 0f06857b91f9a1b0b61ee5651f43e48be857e1cc Mon Sep 17 00:00:00 2001 From: N Pex Date: Wed, 29 Mar 2023 08:49:36 +0000 Subject: [PATCH] Room info, show back arrow even after reload --- src/components/ChatHeader.vue | 5 +---- src/components/RoomInfo.vue | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/components/ChatHeader.vue b/src/components/ChatHeader.vue index 66ed73c..b1681b3 100644 --- a/src/components/ChatHeader.vue +++ b/src/components/ChatHeader.vue @@ -100,7 +100,6 @@ export default { showPurgeConfirmation: false, showMoreMenu: false, downloadingChat: false, - hasShownMissedItemsInfo: false, showMissedItemsInfo: false, /** Timer for showing the "missed items" hint */ @@ -109,7 +108,6 @@ export default { }, mounted() { this.$matrix.on("Room.timeline", this.onEvent); - this.hasShownMissedItemsInfo = this.$store.state.hasShownMissedItemsHint === "1"; this.updateMemberCount(); }, @@ -218,7 +216,7 @@ export default { notifications: { immediate: true, handler(val) { - if (!this.hasShownMissedItemsHint && val > 0 && !this.showMissedItemsInfo && this.timerMissedItems == null) { + if (this.$store.state.hasShownMissedItemsHint !== "1" && val > 0 && !this.showMissedItemsInfo && this.timerMissedItems == null) { this.timerMissedItems = setTimeout(() => { this.showMissedItemsInfo = true; }, 3500); @@ -231,7 +229,6 @@ export default { setHasShownMissedItemsHint() { this.$store.commit('setHasShownMissedItemsHint', "1"); this.showMissedItemsInfo = false; - this.hasShownMissedItemsInfo = true; }, onEvent(event) { if (!this.room || event.getRoomId() !== this.room.roomId) { diff --git a/src/components/RoomInfo.vue b/src/components/RoomInfo.vue index df17c22..5f8f790 100644 --- a/src/components/RoomInfo.vue +++ b/src/components/RoomInfo.vue @@ -5,8 +5,8 @@ arrow_back {{ $t("menu.back") }} @@ -414,7 +414,10 @@ export default { handler(ignoredNewVal, ignoredOldVal) { console.log("RoomInfo: Current room changed"); this.updateMembers(); - this.updateQRCode(); + this.$nextTick(() => { + // Wait a tick, we want to be sure that the QR canvas ref is already created! + this.updateQRCode(); + }); }, }, }, @@ -686,6 +689,23 @@ export default { if (this.room) { this.$matrix.banUser(this.room.roomId, member.userId) } + }, + + /** + * Go back to previous page, or if none on the stack, go back to current room view. + */ + goBack() { + if (this.$navigation.canPop()) { + this.$navigation.pop(); + } else if (this.$matrix.currentRoomId) { + this.$navigation.push( + { + name: "Chat", + params: { roomId: util.sanitizeRoomId(this.$matrix.currentRoomId) }, + }, + -1 + ); + } } }, };