mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge branch 'feature/downloadFile' of bitbucket.org:equilibriumito/gabinete-digital into tempFile
This commit is contained in:
@@ -63,7 +63,8 @@
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
</div>
|
||||
<div class="message">
|
||||
<ion-label>{{msg.msg}}</ion-label>
|
||||
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
|
||||
<ion-label *ngIf="msg.delate == true">{{msg.msg}}</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,7 +93,7 @@
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div *ngIf="msg.file">
|
||||
<div *ngIf="msg.file && msg.delate == false">
|
||||
<div class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' *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>
|
||||
@@ -148,7 +149,9 @@
|
||||
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="msg.file && msg.delate == true">
|
||||
Apagou a mensagem
|
||||
</div>
|
||||
|
||||
<div *ngIf="msg.t == 'r'" class="info-text">
|
||||
<ion-label>Alterou o nome do grupo para "{{msg.msg.split('-').join(' ')}}"</ion-label><br />
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
</div>
|
||||
<div class="middle-container" *ngIf="!showMessageOptions">
|
||||
<div class="middle">
|
||||
<ion-label class="title">{{wsChatMethodsService.getDmRoom(roomId).name}}</ion-label>
|
||||
<!-- <ion-label class="title">{{wsChatMethodsService.getDmRoom(roomId).name}}</ion-label> -->
|
||||
<!-- <span><ion-icon class="{{users.status}}" name="ellipse"></ion-icon></span> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div (click)="wsChatMethodsService.getDmRoom(roomId).deleteAll()" >delete all</div>
|
||||
<div class="middle-container-options" *ngIf="showMessageOptions">
|
||||
<fa-icon (click)="deleteMessage(selectedMsgId)" icon="trash" class="middle-container-options-icons"></fa-icon>
|
||||
<!-- <ion-icon name="trash"></ion-icon> -->
|
||||
@@ -60,6 +62,7 @@
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<<<<<<< HEAD
|
||||
<ion-label>{{msg.msg}}</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
@@ -73,27 +76,29 @@
|
||||
</div>
|
||||
<div>
|
||||
<ion-label>{{msg.msg}}</ion-label>
|
||||
=======
|
||||
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
|
||||
<ion-label *ngIf="msg.delate == true">{{msg.msg}}</ion-label>
|
||||
>>>>>>> c9af986ae8181cf24741ac7407264daea648d27e
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="msg.file">
|
||||
<div (press)="handlePress(msg._id)"
|
||||
class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}'
|
||||
*ngIf="msg.file.type != 'application/meeting'">
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<div *ngIf="msg.attachments" class="message-attachments">
|
||||
<div *ngFor="let file of msg.attachments let i = index">
|
||||
<div *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)">
|
||||
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
|
||||
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
||||
</div>
|
||||
<div *ngIf="msg.file.type != 'application/img'">
|
||||
<div *ngIf="msg.file && msg.delate == false">
|
||||
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' *ngIf="msg.file.type != 'application/meeting'">
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<div *ngIf="msg.attachments" class="message-attachments">
|
||||
<div *ngFor="let file of msg.attachments let i = index">
|
||||
<div *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)">
|
||||
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
|
||||
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
||||
</div>
|
||||
<div *ngIf="msg.file.type != 'application/img'">
|
||||
<div class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'">
|
||||
<div (click)="docIndex(i); viewDocument(msg, file.title_link)"
|
||||
class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
@@ -153,7 +158,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngIf="msg.file">
|
||||
<div *ngIf="msg.file && msg.delate == false">
|
||||
<div *ngIf="msg.file.type == 'application/meeting'" class="info-meeting">
|
||||
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
|
||||
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal">
|
||||
@@ -170,6 +175,10 @@
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
|
||||
<div *ngIf="msg.file && msg.delate == true">
|
||||
Apagou a mensagem
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
|
||||
|
||||
@@ -242,6 +242,7 @@ export class MessageService {
|
||||
|
||||
async delateDB() {
|
||||
|
||||
// alert('delete data')
|
||||
const message = await MessageModel.get({_id: this._id})
|
||||
await message.delete()
|
||||
|
||||
|
||||
@@ -313,8 +313,6 @@ export class RoomService {
|
||||
|
||||
async deleteMessageToReceive(userId) {
|
||||
|
||||
|
||||
|
||||
const allDeleteMessages = await DeleteMessageModel.filter({rid: this.id}).execute()
|
||||
|
||||
for(let message_ of allDeleteMessages) {
|
||||
@@ -392,6 +390,15 @@ export class RoomService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
deleteAll() {
|
||||
this.messages.forEach((message)=>{
|
||||
if(message?._id) {
|
||||
this.sendDeleteRequest(message._id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async delateMessageToSendToOthers(userId) {
|
||||
|
||||
const deleteMessage = await DeleteMessageModel.all()
|
||||
@@ -410,10 +417,12 @@ export class RoomService {
|
||||
(response: any) => {
|
||||
message.delateRequest = true
|
||||
message.save()
|
||||
this.deleteMessage(msgId)
|
||||
},
|
||||
(response) => {
|
||||
|
||||
if (response.error.error.startsWith('No message found with the id of')) {
|
||||
// alert('not found')
|
||||
this.deleteMessage(msgId)
|
||||
} else {
|
||||
// this.deleteMessage(DeletedMessageId)
|
||||
@@ -429,6 +438,7 @@ export class RoomService {
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -553,7 +563,7 @@ export class RoomService {
|
||||
const wewMessage = await this.simplePrepareMessage(ChatMessage)
|
||||
|
||||
if(wewMessage.offline == false) {
|
||||
const message = await this.prepareMessageCreateIfNotExist({message:ChatMessage})
|
||||
const message = await this.prepareMessageCreateIfNotExist_iD({message:ChatMessage})
|
||||
|
||||
message?.decryptMessage()
|
||||
} else {
|
||||
@@ -584,7 +594,7 @@ export class RoomService {
|
||||
}
|
||||
|
||||
// runs onces only
|
||||
async loadHistory({limit = 10000000, forceUpdate = false }) {
|
||||
async loadHistory({limit = 1000, forceUpdate = false }) {
|
||||
|
||||
if(forceUpdate == false) {
|
||||
if (this.hasLoadHistory) {
|
||||
@@ -599,12 +609,14 @@ export class RoomService {
|
||||
|
||||
await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => {
|
||||
|
||||
console.log('load chatHistory', JSON.stringify(chatHistory))
|
||||
|
||||
const messagesId = this.messages.map((message)=> message._id)
|
||||
|
||||
chatHistory.result.messages.reverse().forEach(async(message: any) => {
|
||||
|
||||
if (!messagesId.includes(message._id)) {
|
||||
const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
|
||||
const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message});
|
||||
if(messagesToSave) {
|
||||
await messagesToSave.addMessageDB()
|
||||
}
|
||||
@@ -612,7 +624,6 @@ export class RoomService {
|
||||
|
||||
})
|
||||
|
||||
// console.log('load chatHistory', chatHistory)
|
||||
|
||||
})
|
||||
|
||||
@@ -755,6 +766,27 @@ export class RoomService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async prepareMessageCreateIfNotExist_iD({message}) {
|
||||
message = this.fix_updatedAt(message)
|
||||
|
||||
const found = this.messages.find((MessageService, index) => {
|
||||
if (MessageService._id == message._id ) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
if (!found) {
|
||||
const wewMessage = this.simplePrepareMessage(message)
|
||||
this.messages.push(wewMessage)
|
||||
return wewMessage
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
private calDateDuration(date = null) {
|
||||
this.duration = showDateDuration(date || this._updatedAt);
|
||||
this._updatedAt = date || this._updatedAt
|
||||
|
||||
@@ -23,10 +23,7 @@
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div *ngIf="room.customFields.countDownDate" class="d-flex align-items-center yellow-orange pl-10">
|
||||
<i class="far fa-clock font-15" ></i>
|
||||
<ion-label class="font-15 pl-10" color="warning">{{countDownDate()}}</ion-label>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
@@ -57,12 +54,13 @@
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
</div>
|
||||
<div class="message">
|
||||
<ion-label>{{msg.msg}}</ion-label>
|
||||
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
|
||||
<ion-label *ngIf="msg.delate == true">{{msg.msg}}</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="msg.file">
|
||||
<div *ngIf="msg.file && msg.delate == false">
|
||||
<div class="message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.file.type != 'application/meeting'" >
|
||||
<div *ngIf="msg.file.type != 'application/meeting'">
|
||||
<div class="message-item-options d-flex justify-content-end">
|
||||
@@ -126,35 +124,10 @@
|
||||
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45' *ngIf="msg.msg ==''">
|
||||
<div *ngIf="msg.file.type == 'application/img'">
|
||||
<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)="deleteMessage(msg._id)" class="menuButton">Apagar mensagem</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<ion-label>{{msg.msg}}</ion-label>
|
||||
<div *ngIf="msg.file" class="message-attachments">
|
||||
<div>
|
||||
<div (click)="openPreview(msg)">
|
||||
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="msg.file && msg.delate == true">
|
||||
Apagou a mensagem
|
||||
</div>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<div *ngIf="msg.t == 'r'" class="info-text">
|
||||
<ion-label>Alterou o nome do grupo para "{{msg.msg.split('-').join(' ')}}"</ion-label><br />
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div *ngIf="frameUrl" class="width-100">
|
||||
<iframe id="iframe" [src]="frameUrl" height="20%" width="100%" title="Iframe Example">
|
||||
</iframe>
|
||||
</div> -->
|
||||
<div hidden class="header-bottom" (click)="addContacts()">
|
||||
<div class="header-bottom-icon">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/icon/icons-user.svg"></ion-icon>
|
||||
@@ -68,7 +64,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="msg.file">
|
||||
<div *ngIf="msg.file && msg.delate == false">
|
||||
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45'
|
||||
*ngIf="msg.file.type != 'application/meeting'">
|
||||
<div class="message-item-options d-flex justify-content-end">
|
||||
@@ -159,8 +155,14 @@
|
||||
</ion-label><br />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="msg.file && msg.delate == true">
|
||||
Apagou a mensagem
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
|
||||
<ion-fab-button *ngIf="scrollToBottomBtn" (click)="scrollToBottomClicked()" color="light" size="small">
|
||||
<ion-icon name="chevron-down"></ion-icon>
|
||||
|
||||
@@ -6,5 +6,5 @@ export const environment = {
|
||||
domain: 'gabinetedigital.local',
|
||||
defaultuser: '',//paulo.pinto paulo.pinto@gabinetedigital.local
|
||||
defaultuserpwd: '', //tabteste@006,
|
||||
chatOffline: false
|
||||
chatOffline: true
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user