set member to admin

This commit is contained in:
Peter Maquiran
2024-08-06 11:24:00 +01:00
parent 7e14f55383
commit 2f214e0025
3889 changed files with 581 additions and 1962886 deletions
@@ -101,10 +101,10 @@ export class GroupContactsPage implements OnInit {
console.log({currentMemberToMap})
this.currentMembers = currentMemberToMap.map((e)=> ({
userPhoto: e.user.userPhoto,
wxeMail: e.user.wxeMail,
wxFullName: e.user.wxFullName,
wxUserId: e.user.wxUserId
userPhoto: e.userPhoto,
wxeMail: e.wxeMail,
wxFullName: e.wxFullName,
wxUserId: e.wxUserId
}))
@@ -5,7 +5,7 @@
<div class="middle" >
<ion-label class="title"> {{ roomData.roomName }}</ion-label>
<!-- <button (click)="ChatMessageDebuggingPage()">Dev</button> -->
<span><ion-icon *ngIf="RochetChatConnectorService.isLogin" class="online" name="ellipse"></ion-icon></span>
<span *ngIf="roomStatus$ | async as roomStatus"><ion-icon *ngIf="roomStatus" class="online" name="ellipse"></ion-icon></span>
</div>
<div class="right">
<button title="Menu" class="btn-no-color" (click)="_openMessagesOptions()">
@@ -24,7 +24,7 @@
<ion-list class="header-bottom-contacts" *ngIf="roomMembers$ | async as memberList">
<ng-container *ngFor="let user of memberList; let i = index">
{{ user.user.wxFullName }}<ng-container *ngIf="i < memberList.length - 1">, </ng-container>
{{ user.wxFullName }}<ng-container *ngIf="i < memberList.length - 1">, </ng-container>
</ng-container>
</ion-list>
@@ -47,12 +47,12 @@
*ngFor="let message of roomMessage$ | async" class="messages-list-item-wrapper"
[ngClass]="{'my-message': message.sender.wxUserId === sessionStore.user.UserId, 'other-message': message.sender.wxUserId !== sessionStore.user.UserId}">
<div class="message-container">
{{ message.message }} .== {{ message.id }}
{{ message.message }} .== {{ message.$id }}
<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">
<button (click)="messageDelete({messageId: message.messageId })" class="menuButton">Apagar mensagem</button>
<button (click)="messageDelete({messageId: message.id })" class="menuButton">Apagar mensagem</button>
<button (click)="editMessage(message)" class="menuButton">Editar mensagem</button>
<button (click)="toggleEmojiPicker(message)" class="menuButton">Reagir mensagem</button>
</mat-menu>
@@ -122,6 +122,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
textField = ''
roomData$: DexieObservable<RoomListItemOutPutDTO | undefined>
roomStatus$: DexieObservable<Boolean >
roomMessage$: DexieObservable<TableMessage[]>
roomMembers$: DexieObservable<TableMemberList[] | undefined>
//userTyping$: DexieObservable<UserTypingList[] | undefined>
@@ -160,10 +161,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
ngOnChanges(changes: SimpleChanges): void {
console.log('change ¬!!')
this.roomData$ = this.roomRepositoryService.getItemByIdLive(this.roomId)
this.roomMessage$ = this.messageRepositoryService.getItemsLive(this.roomId)
this.roomMembers$ = this.roomRepositoryService.getRoomMemberByIdLive(this.roomId) as any
this.roomStatus$ = this.roomRepositoryService.getRoomStatus(this.roomId)
this.roomRepositoryService.getRoomById(this.roomId)
this.messageRepositoryService.listAllMessagesByRoomId(this.roomId)
@@ -214,7 +215,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.chatServiceService.reactToMessage({
memberId: SessionStore.user.UserId,
messageId: message.messageId,
messageId: message.id,
roomId: this.roomId,
reaction: emoji,
requestId: ''
@@ -251,7 +252,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.chatServiceService.updateMessage({
memberId: SessionStore.user.UserId,
message: res.data.message,
messageId: message.messageId,
messageId: message.id,
requestId: '',
roomId: this.roomId
})
+38 -39
View File
@@ -20,7 +20,7 @@ export class NewGroupPage implements OnInit{
showLoader: boolean;
displayDuration: any;
showDuration: boolean;
expirationDate:any;
expirationDate:Date = null;
_day:any;
selectedDuration = ['','',''];
countDownTime:any;
@@ -93,7 +93,7 @@ export class NewGroupPage implements OnInit{
this.expirationDate = new Date();
}
else {
this.expirationDate = '';
this.expirationDate = null;
}
}
@@ -123,9 +123,8 @@ export class NewGroupPage implements OnInit{
roomName: this.groupName,
createdBy: SessionStore.user.UserId,
roomType: 0,
expirationDate: null,
expirationDate: this.expirationDate?.toISOString(),
members: []
})
if(result.isOk()) {
@@ -147,44 +146,44 @@ export class NewGroupPage implements OnInit{
}
createGroupWithAttachments(res: any) {
this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
// this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
if(this.documents) {
this.documents.forEach(element => {
this.ChatSystemService.getGroupRoom(res.result.rid).send({
file: {
"name": element.Assunto,
"type": "application/webtrix",
"ApplicationId": element.ApplicationId,
"DocId": element.DocId,
"Assunto": element.Assunto,
},
temporaryData: {
data: {
selected: {
Id: element.DocId,
ApplicationType: element.ApplicationId
}
}
},
attachments: [{
"title": element.Assunto,
"description": element.Assunto,
"title_link_download": true,
"type": "webtrix",
"text": element.Assunto,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
})
});
}
// if(this.documents) {
// this.documents.forEach(element => {
// this.ChatSystemService.getGroupRoom(res.result.rid).send({
// file: {
// "name": element.Assunto,
// "type": "application/webtrix",
// "ApplicationId": element.ApplicationId,
// "DocId": element.DocId,
// "Assunto": element.Assunto,
// },
// temporaryData: {
// data: {
// selected: {
// Id: element.DocId,
// ApplicationType: element.ApplicationId
// }
// }
// },
// attachments: [{
// "title": element.Assunto,
// "description": element.Assunto,
// "title_link_download": true,
// "type": "webtrix",
// "text": element.Assunto,
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
// }],
// })
// });
// }
this.ChatSystemService.getAllRooms();
// this.ChatSystemService.getAllRooms();
setTimeout(() => {
this.groupName = ""
}, 150);
// setTimeout(() => {
// this.groupName = ""
// }, 150);
}
@@ -211,7 +210,7 @@ export class NewGroupPage implements OnInit{
handler:(value:any)=>{
let now = new Date();
this.expirationDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds());
this.expirationDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds())
this.selectedDuration = [
value.days.value,
@@ -23,6 +23,7 @@
<button (click)="leaveGroup()" class="btn-cancel" shape="round">Sair do Grupo</button>
<button (click)="openChangeGroupName()" class="btn-cancel btn-cancel mt-10" shape="round" style="min-width: 192px;">Alterar
nome do grupo</button>
<button (click)="setRoomOwner()" class="btn-cancel" shape="round">Adicionar admin</button>
<div class="solid"></div>
<button (click)="close('cancel')" full class="btn-cancel mobile-only" shape="round">Cancelar</button>
<button (click)="deleteGroup()" class="btn-delete" shape="round">Apagar grupo</button>
@@ -18,7 +18,6 @@ import { RoomRepositoryService } from 'src/app/module/chat/data/repository/room-
export class ChatPopoverPage implements OnInit {
roomId:string;
room: any;
members:any;
isAdmin = false;
isGroupCreated: boolean;
showLoader = false
@@ -27,13 +26,11 @@ export class ChatPopoverPage implements OnInit {
private popoverController: PopoverController,
private modalController: ModalController,
private navParams: NavParams,
private chatService: ChatService,
private toastService: ToastService,
public ThemeService: ThemeService,
private RoomRepositoryService: RoomRepositoryService
) {
this.roomId = this.navParams.get('roomId');
this.members = this.navParams.get('members');
this.isAdmin = this.navParams.get('isAdmin');
}
@@ -54,7 +51,7 @@ export class ChatPopoverPage implements OnInit {
//Top menu options
//Close
async setRoomOwner(){
async setRoomOwner() {
let classs;
if (window.innerWidth < 701) {
classs = 'modal modal-desktop'
@@ -67,7 +64,6 @@ export class ChatPopoverPage implements OnInit {
backdropDismiss: true,
componentProps: {
roomId: this.roomId,
members: this.members,
isAdmin: this.isAdmin
}
});
@@ -80,8 +76,14 @@ export class ChatPopoverPage implements OnInit {
});
}
setAdmin() {
this.setRoomOwner();
}
async leaveGroup() {
//this.setRoomOwner();
this.showLoader = true
const result = await this.RoomRepositoryService.leaveRoom({
id: this.roomId,