Detect leave dialog last room
This commit is contained in:
parent
b7d280f675
commit
7506280ab1
3 changed files with 20 additions and 4 deletions
|
|
@ -586,7 +586,7 @@ export default {
|
||||||
const createEvent = this.room.currentState.getStateEvents("m.room.create","");
|
const createEvent = this.room.currentState.getStateEvents("m.room.create","");
|
||||||
if (createEvent) {
|
if (createEvent) {
|
||||||
const creatorId = createEvent.getContent().creator;
|
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;
|
this.showCreatedRoomWelcomeHeader = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@
|
||||||
<h2 class="dialog-title">
|
<h2 class="dialog-title">
|
||||||
Goodbye, {{ $matrix.currentUserDisplayName }}.
|
Goodbye, {{ $matrix.currentUserDisplayName }}.
|
||||||
</h2>
|
</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>.
|
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>
|
||||||
<div v-else class="dialog-text">
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<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: {
|
methods: {
|
||||||
onLeaveRoom() {
|
onLeaveRoom() {
|
||||||
//this.$matrix.matrixClient.forget(this.room.roomId, true, undefined)
|
//this.$matrix.matrixClient.forget(this.room.roomId, true, undefined)
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,12 @@ export default {
|
||||||
currentRoomId() {
|
currentRoomId() {
|
||||||
return this.$store.state.currentRoomId;
|
return this.$store.state.currentRoomId;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
joinedRooms() {
|
||||||
|
return this.rooms.filter(room => {
|
||||||
|
return room._selfMembership === 'join'
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -367,7 +373,7 @@ export default {
|
||||||
var ids = {};
|
var ids = {};
|
||||||
const ret = [];
|
const ret = [];
|
||||||
for (const room of this.rooms) {
|
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()) {
|
for (const member of room.getJoinedMembers()) {
|
||||||
if (member.userId != this.currentUserId && !ids[member.userId]) {
|
if (member.userId != this.currentUserId && !ids[member.userId]) {
|
||||||
ids[member.userId] = member;
|
ids[member.userId] = member;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue