Room info, show back arrow even after reload

This commit is contained in:
N Pex 2023-03-29 08:49:36 +00:00
parent e794a95c68
commit 0f06857b91
2 changed files with 24 additions and 7 deletions

View file

@ -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) {

View file

@ -5,8 +5,8 @@
<v-btn
id="btn-back"
text
:class="$navigation && $navigation.canPop() ? 'v-visible' : 'v-hidden'"
@click.stop="$navigation.pop"
:class="(($navigation && $navigation.canPop()) || $matrix.currentRoomId) ? 'v-visible' : 'v-hidden'"
@click.stop="goBack()"
>
<v-icon>arrow_back</v-icon>
<span class="d-none d-sm-block">{{ $t("menu.back") }}</span>
@ -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
);
}
}
},
};