Detect leave dialog last room

This commit is contained in:
N-Pex 2021-04-02 10:06:25 +02:00
parent b7d280f675
commit 7506280ab1
3 changed files with 20 additions and 4 deletions

View file

@ -586,7 +586,7 @@ export default {
const createEvent = this.room.currentState.getStateEvents("m.room.create","");
if (createEvent) {
const creatorId = createEvent.getContent().creator;
if (creatorId == this.$matrix.currentUserId && createEvent.getLocalAge() < (2000 * 60000) /* 2 minutes */) {
if (creatorId == this.$matrix.currentUserId && createEvent.getLocalAge() < (5 * 60000) /* 5 minutes */) {
this.showCreatedRoomWelcomeHeader = true;
}
}

View file

@ -6,11 +6,11 @@
<h2 class="dialog-title">
Goodbye, {{ $matrix.currentUserDisplayName }}.
</h2>
<div v-if="$matrix.currentUser.is_guest" class="dialog-text">
<div v-if="$matrix.currentUser.is_guest && onlyJoinedToThisRoom" class="dialog-text">
If you want to join this group again, you can join under a new identity. To keep {{ $matrix.currentUserDisplayName }}, <a @click.prevent="viewProfile">create an account</a>.
</div>
<div v-else class="dialog-text">
Since this group is public, you can join again later.
You can always join this room again if you know the link.
</div>
</template>
<template v-else>
@ -82,6 +82,16 @@ export default {
},
},
computed: {
onlyJoinedToThisRoom() {
const joinedRooms = this.$matrix.joinedRooms;
if (joinedRooms && joinedRooms.length == 1 && joinedRooms[0].roomId == this.room.roomId) {
return true;
}
return false;
}
},
methods: {
onLeaveRoom() {
//this.$matrix.matrixClient.forget(this.room.roomId, true, undefined)

View file

@ -61,6 +61,12 @@ export default {
currentRoomId() {
return this.$store.state.currentRoomId;
},
joinedRooms() {
return this.rooms.filter(room => {
return room._selfMembership === 'join'
});
},
},
watch: {
@ -367,7 +373,7 @@ export default {
var ids = {};
const ret = [];
for (const room of this.rooms) {
if (room._selfMembership == 'join') { // && this.getRoomJoinRule(room) == 'invite') {
if (room._selfMembership == 'join' && this.getRoomJoinRule(room) == 'invite') {
for (const member of room.getJoinedMembers()) {
if (member.userId != this.currentUserId && !ids[member.userId]) {
ids[member.userId] = member;