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
@@ -57,7 +57,7 @@
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
</div>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getGroupRoom(roomId).messages; let last = last" [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.RochetChatUser}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" (press)="handlePress(msg._id)">
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" (press)="handlePress(msg._id)">
<div class="title">
<ion-label>{{msg.u.name ?? ""}}</ion-label>
<span class="time">{{msg.duration}}</span>
@@ -78,7 +78,7 @@
</div>
<!-- <div class='message-item incoming-{{msg.u.username!=sessionStore.user.RochetChatUser}} max-width-45' *ngIf="msg.msg ==''">
<!-- <div class='message-item incoming-{{msg.u.username!=sessionStore.user.UserName}} max-width-45' *ngIf="msg.msg ==''">
<div *ngIf="msg.file.type == 'application/img'">
<div class="message-item-options d-flex justify-content-end">
</div>
@@ -102,7 +102,7 @@
</div> -->
<div *ngIf="msg.file && msg.delate == false">
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.RochetChatUser}}' class='message-container incoming-{{msg.u.username!=sessionStore.user.RochetChatUser}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.file.type != 'application/meeting'" (press)="handlePress(msg._id)">
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' class='message-container incoming-{{msg.u.username!=sessionStore.user.RochetChatUser}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.file.type != 'application/meeting'" (press)="handlePress(msg._id)">
<div class="title">
<ion-label>{{msg.u.name ?? ""}}</ion-label>
<span class="time">{{msg.duration}}</span>
@@ -90,7 +90,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
duration = 0;
showAvatar = true;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
essionStore = SessionStore
sessionStore = SessionStore
constructor(
private menu: MenuController,
private modalController: ModalController,
@@ -50,7 +50,7 @@
<div class="messages-list-item-wrapper container-width-100"
*ngFor="let msg of wsChatMethodsService.getDmRoom(this.roomId).messages; let last = last"
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=sessionStore.user.RochetChatUser}}'
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
*ngIf="msg.msg !=''">
<div class="title">
<ion-label (click)="hkellor()">{{msg.u.name}}</ion-label>
-3
View File
@@ -110,9 +110,6 @@ export class LoginPage implements OnInit {
await this.authService.SetSession(attempt, this.userattempt);
console.log(this.p.userPermission(this.p.permissionList.Chat.access));
/* if(this.p.userPermission(this.p.permissionList.Chat.access)){*/
await this.authService.loginChat(attempt.ChatData.data);
await this.authService.loginToChatWs();
+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) {
@@ -42,7 +42,7 @@
</div>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getGroupRoom(roomId).messages; let last = last">
<div class="message-item incoming-{{msg.u.username!=sessionStore.user.RochetChatUser}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" >
<div class="message-item incoming-{{msg.u.username!=sessionStore.user.UserName}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" >
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
<mat-menu #beforeMenu="matMenu" xPosition="before">
@@ -36,7 +36,7 @@
<div class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100"
*ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).messages; index as i; let last = last">
<div class='message-item incoming-{{msg.u.username!=sessionStore.user.RochetChatUser}} max-width-45' *ngIf="msg.msg !=''">
<div class='message-item incoming-{{msg.u.username!=sessionStore.user.UserName}} max-width-45' *ngIf="msg.msg !=''">
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer">
</fa-icon>