fix delete member and add member

This commit is contained in:
Peter Maquiran
2024-09-17 17:28:50 +01:00
parent 1bc5707321
commit 263f593260
9 changed files with 33 additions and 31 deletions
+17 -17
View File
@@ -63,34 +63,34 @@ export class RoomEntity extends BaseEntity<RoomEntity>(RoomEntitySchema) implem
if(data.roomType == RoomType.Direct) {
this.setName()
}
if(!this.$id) {
this.setLocalId()
}
if(!this.$id) {
this.$id = this.getReceiverId()
}
if(this.roomType == RoomType.Direct && !this.receiverId && this.members.length == 2) {
this.setReceiver()
if(!this.receiverId && this.members.length == 2) {
this.setReceiver()
}
}
}
// direct room only
getReceiverId() {
const receiver = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
return receiver.user.wxUserId.toString()
}
// direct room only
setLocalId() {
const receiver = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
if(receiver) {
this.$id =receiver.user.wxUserId.toString()
}
this.$id = this.getReceiverId()
}
// direct room only
setReceiver() {
const receiver = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
if(receiver) {
this.receiverId = receiver.user.wxUserId
}
this.receiverId = parseInt(this.getReceiverId())
}
// direct room only
setName() {
const userChatName = this.members?.find((e) => e.user.wxUserId != SessionStore.user.UserId)
if(userChatName) {