This commit is contained in:
Peter Maquiran
2022-04-19 16:03:59 +01:00
parent 55f804a5d1
commit e16222e230
9 changed files with 23 additions and 26 deletions
+5 -5
View File
@@ -75,7 +75,7 @@ export class MessageService {
this.msg = msg || ""
this.rid = rid
this.ts = ts
this.u = u || { name: this.usernameToDisplayName(SessionStore.user.RochetChatUser), username: SessionStore.user.RochetChatUser, _id: ""}
this.u = u || { name: this.usernameToDisplayName(SessionStore.user.UserName), username: SessionStore.user.UserName, _id: ""}
this.t = t
this._id = _id
this._updatedAt = _updatedAt || new Date().getTime()
@@ -287,18 +287,18 @@ console.log(params)
isSenderIsNotMe(ChatMessage) {
return SessionStore.user.RochetChatUser != ChatMessage.u.username
return SessionStore.user.UserName != ChatMessage.u.username
}
messageOwnerById(id) {
return SessionStore.user.RochetChatUser != this.u.username
return SessionStore.user.UserName != this.u.username
}
private getChatObj() {
return {
channels: this.channels,
mentions: this.mentions,
//msg: this.AESEncrypt.encrypt(this.msg, SessionStore.user.RochetChatUser),
//msg: this.AESEncrypt.encrypt(this.msg, SessionStore.user.UserName),
msg:this.msg,
rid: this.rid,
ts: this.ts,
@@ -339,7 +339,7 @@ console.log(params)
decryptMessage() {
try {
// this.msg = this.AESEncrypt.decrypt(this.msg, SessionStore.user.RochetChatUser)
// this.msg = this.AESEncrypt.decrypt(this.msg, SessionStore.user.UserName)
} catch (error) {}
}
+5 -5
View File
@@ -161,7 +161,7 @@ export class RoomService {
isSenderIsNotMe(ChatMessage) {
return SessionStore.user.RochetChatUser != ChatMessage.u.username
return SessionStore.user.UserName != ChatMessage.u.username
}
senderId(ChatMessage) {
@@ -371,7 +371,7 @@ export class RoomService {
if(this.messages[i]?._id == id ) {
if (SessionStore.user.RochetChatUser == this.messages[i]?.u?.username) {
if (SessionStore.user.UserName == this.messages[i]?.u?.username) {
const allMemberThatIsOffline = this.getAllMemberThatIsOffline()
DeleteMessageModel.create({
@@ -500,7 +500,7 @@ export class RoomService {
}
if(lastIsTyping != this.isTyping) {
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.RochetChatUser, 'typing', this.isTyping)
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', this.isTyping)
}
@@ -509,7 +509,7 @@ export class RoomService {
}
sendFalseTypingReadMessage(method,param: object) {
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.RochetChatUser, 'typing', {method:method, params: param} as falseTypingMethod)
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', {method:method, params: param} as falseTypingMethod)
this.setTypingOff()
}
@@ -521,7 +521,7 @@ export class RoomService {
if(this.isTyping == true) {
this.isTyping = false
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.RochetChatUser, 'typing', this.isTyping)
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', this.isTyping)
}
} else {
@@ -184,7 +184,7 @@ export class WsChatMethodsService {
const res = await this.chatService.getMembers(roomId).toPromise();
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.RochetChatUser);
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
rooms.result.update[index]['members'] = users
await this.prepareRoom(roomData);
@@ -192,7 +192,7 @@ export class WsChatMethodsService {
if (roomData.t === 'p') {
const res = await this.chatService.getGroupMembers(roomId).toPromise()
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.RochetChatUser);
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
rooms.result.update[index]['members'] = users
@@ -200,7 +200,7 @@ export class WsChatMethodsService {
else {
const res = await this.chatService.getChannelMembers(roomId).toPromise()
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.RochetChatUser);
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
rooms.result.update[index]['members'] = users
@@ -366,7 +366,7 @@ export class WsChatMethodsService {
getReceptorName(roomData) {
try {
return roomData.usernames.find((e)=> e != SessionStore.user.RochetChatUser)
return roomData.usernames.find((e)=> e != SessionStore.user.UserName)
} catch(e) {
return '*'
}
@@ -476,7 +476,7 @@ export class WsChatMethodsService {
if(this.isIndividual(roomData)) {
const names: String[] = roomData.usernames
const roomName = names.filter((name, index)=>{
return name != SessionStore.user.RochetChatUser
return name != SessionStore.user.UserName
})[0]
const firstName = capitalizeTxt(roomName.split('.')[0])
@@ -507,7 +507,7 @@ export class WsChatMethodsService {
let _res = await this.ChatService.getAllUsers().toPromise()
let users = _res['users'].filter(data => data.username != SessionStore.user.RochetChatUser);
let users = _res['users'].filter(data => data.username != SessionStore.user.UserName);
users = users.sort((a,b) => {
if(a.name < b.name) {