mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix
This commit is contained in:
@@ -502,6 +502,7 @@ export class MessageService {
|
||||
ts: this.ts,
|
||||
u: this.u,
|
||||
_id: this._id,
|
||||
t: this.t,
|
||||
id: this.id,
|
||||
hasFile: this.hasFile,
|
||||
origin: this.origin,
|
||||
|
||||
@@ -360,6 +360,12 @@ export class RoomService {
|
||||
|
||||
}
|
||||
|
||||
if(ChatMessage?.t == "au") {
|
||||
this.updateContacts()
|
||||
} else if (ChatMessage?.t == "r") {
|
||||
this.name = ChatMessage.msg
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
done()
|
||||
}, 5)
|
||||
@@ -949,14 +955,73 @@ export class RoomService {
|
||||
this.messageUnread = false
|
||||
}
|
||||
|
||||
addContacts(userId:any) {
|
||||
async addContacts(userId:any) {
|
||||
|
||||
let body = {
|
||||
"roomId": this.id,
|
||||
"userId": userId,
|
||||
}
|
||||
|
||||
return this.chatService.addUserToGroup(body).toPromise();
|
||||
await this.chatService.addUserToGroup(body).toPromise();
|
||||
this.ChatSystemService.getGroupRoom(this.id).updateContacts()
|
||||
}
|
||||
|
||||
|
||||
async updateContacts() {
|
||||
|
||||
let res
|
||||
let error = false
|
||||
|
||||
if(this.t == 'd') {
|
||||
|
||||
try {
|
||||
res = await this.chatService.getMembers(this.id).toPromise();
|
||||
} catch (e) {
|
||||
await this.chatService.refreshtoken();
|
||||
error = true
|
||||
}
|
||||
|
||||
if(error) {
|
||||
res = await this.chatService.getMembers(this.id).toPromise();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (this.t === 'p') {
|
||||
|
||||
try {
|
||||
res = await this.chatService.getGroupMembers(this.id).toPromise()
|
||||
} catch (e) {
|
||||
await this.chatService.refreshtoken();
|
||||
error = true
|
||||
}
|
||||
|
||||
if(error) {
|
||||
res = await this.chatService.getGroupMembers(this.id).toPromise()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
try {
|
||||
res = await this.chatService.getChannelMembers(this.id).toPromise()
|
||||
|
||||
} catch (e) {
|
||||
await this.chatService.refreshtoken();
|
||||
error = true
|
||||
}
|
||||
|
||||
if(error) {
|
||||
res = await this.chatService.getChannelMembers(this.id).toPromise()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const members = res['members'];
|
||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
||||
this.members = members
|
||||
this.membersExcludeMe = users
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user