"Private chat" header for direct chats

Also, auto-create account and room when joining a DM chat link.
This commit is contained in:
N-Pex 2023-08-30 10:50:45 +02:00
parent 46bd105449
commit 68b241b6ce
9 changed files with 437 additions and 37 deletions

View file

@ -82,6 +82,23 @@ export default {
return isAdmin;
},
isPrivate() {
return this.$matrix.isDirectRoom(this.room);
},
/**
* If this is a direct chat with someone, return that member here.
* @returns MXMember of the one we are chatting with, or 'undefined'.
*/
privateParty() {
if (this.isPrivate) {
const membersButMe = this.room.getMembers().filter(m => m.userId != this.$matrix.currentUserId);
if (membersButMe.length == 1) {
return membersButMe[0];
}
}
return undefined;
},
},
watch: {
room: {
@ -165,5 +182,19 @@ export default {
this.updatePermissions();
}
},
privatePartyAvatar(size) {
const other = this.privateParty;
if (other) {
return other.getAvatarUrl(
this.$matrix.matrixClient.getHomeserverUrl(),
size,
size,
"scale",
true
);
}
return undefined;
},
},
}