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, showPurgeConfirmation: false,
showMoreMenu: false, showMoreMenu: false,
downloadingChat: false, downloadingChat: false,
hasShownMissedItemsInfo: false,
showMissedItemsInfo: false, showMissedItemsInfo: false,
/** Timer for showing the "missed items" hint */ /** Timer for showing the "missed items" hint */
@ -109,7 +108,6 @@ export default {
}, },
mounted() { mounted() {
this.$matrix.on("Room.timeline", this.onEvent); this.$matrix.on("Room.timeline", this.onEvent);
this.hasShownMissedItemsInfo = this.$store.state.hasShownMissedItemsHint === "1";
this.updateMemberCount(); this.updateMemberCount();
}, },
@ -218,7 +216,7 @@ export default {
notifications: { notifications: {
immediate: true, immediate: true,
handler(val) { 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.timerMissedItems = setTimeout(() => {
this.showMissedItemsInfo = true; this.showMissedItemsInfo = true;
}, 3500); }, 3500);
@ -231,7 +229,6 @@ export default {
setHasShownMissedItemsHint() { setHasShownMissedItemsHint() {
this.$store.commit('setHasShownMissedItemsHint', "1"); this.$store.commit('setHasShownMissedItemsHint', "1");
this.showMissedItemsInfo = false; this.showMissedItemsInfo = false;
this.hasShownMissedItemsInfo = true;
}, },
onEvent(event) { onEvent(event) {
if (!this.room || event.getRoomId() !== this.room.roomId) { if (!this.room || event.getRoomId() !== this.room.roomId) {

View file

@ -5,8 +5,8 @@
<v-btn <v-btn
id="btn-back" id="btn-back"
text text
:class="$navigation && $navigation.canPop() ? 'v-visible' : 'v-hidden'" :class="(($navigation && $navigation.canPop()) || $matrix.currentRoomId) ? 'v-visible' : 'v-hidden'"
@click.stop="$navigation.pop" @click.stop="goBack()"
> >
<v-icon>arrow_back</v-icon> <v-icon>arrow_back</v-icon>
<span class="d-none d-sm-block">{{ $t("menu.back") }}</span> <span class="d-none d-sm-block">{{ $t("menu.back") }}</span>
@ -414,7 +414,10 @@ export default {
handler(ignoredNewVal, ignoredOldVal) { handler(ignoredNewVal, ignoredOldVal) {
console.log("RoomInfo: Current room changed"); console.log("RoomInfo: Current room changed");
this.updateMembers(); this.updateMembers();
this.$nextTick(() => {
// Wait a tick, we want to be sure that the QR canvas ref is already created!
this.updateQRCode(); this.updateQRCode();
});
}, },
}, },
}, },
@ -686,6 +689,23 @@ export default {
if (this.room) { if (this.room) {
this.$matrix.banUser(this.room.roomId, member.userId) 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
);
}
} }
}, },
}; };