mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix
This commit is contained in:
@@ -126,6 +126,12 @@ export class HomePage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
window.addEventListener('storage', (event) => {
|
||||
// When local storage changes, dump the list to
|
||||
// the console.
|
||||
console.log(event);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
goto(url) {
|
||||
|
||||
@@ -11,6 +11,7 @@ export class MessageModel extends models.Model {
|
||||
ts = JsonField({blank:true})
|
||||
u = JsonField()
|
||||
_id = models.CharField({blank:true})
|
||||
origin = models.CharField({blank:true})
|
||||
_updatedAt = models.IntegerField()
|
||||
messageSend = models.BooleanField()
|
||||
offline = models.BooleanField()
|
||||
@@ -41,7 +42,7 @@ export class DeleteMessageModel extends models.Model {
|
||||
models.register({
|
||||
databaseName: 'chat-storage'+environment.version.lastCommitNumber,
|
||||
type: 'indexedDB',
|
||||
version: 10,
|
||||
version: 11,
|
||||
models: [MessageModel, DeleteMessageModel, attachments]
|
||||
})
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ export interface Message {
|
||||
u: U;
|
||||
from: 'Offline'|'History'|'stream'| 'send'
|
||||
t: string;
|
||||
origin: 'history' | 'stream' | 'local'
|
||||
_updatedAt: '';
|
||||
mentions: any[];
|
||||
channels: any[];
|
||||
|
||||
@@ -43,6 +43,7 @@ export interface ChatMessageInterface {
|
||||
_updatedAt: number;
|
||||
mentions: any[];
|
||||
channels: any[];
|
||||
origin?: 'history' | 'stream' | 'local'
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Move forward one screen of the slides -->
|
||||
<div (click)="next()" class="arrow cursor-pointer resize">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="icon-only" src="assets/images/icons-calendar-arrow-right.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="icon-only" src="assets/images/theme/gov/icons-calendar-arrow-right.svg"></ion-icon>
|
||||
@@ -114,11 +113,11 @@
|
||||
|
||||
</div>
|
||||
|
||||
<button *ngIf="profile == 'mdgpr' && ( SessionStore.user.Profile == 'PR' || SessionStore.user.Profile == 'MDGPR') " (click)="changeProfile()" class="d-md-none btn-no-color resize">
|
||||
<button *ngIf="profile == 'mdgpr' && ( SessionStore.user.Profile == 'PR' || SessionStore.user.Profile == 'MDGPR') && eventService.hasSharedCalendar " (click)="changeProfile()" class="d-md-none btn-no-color resize">
|
||||
<ion-icon class="right-icons" src="assets/images/icons-profile-calendar-md.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
<button title="Mudar de Agenda" *ngIf="profile == 'pr'&& ( SessionStore.user.Profile == 'PR' || SessionStore.user.Profile == 'MDGPR')" (click)="changeProfile()" class="btn-no-color resize">
|
||||
<button title="Mudar de Agenda" *ngIf="profile == 'pr'&& ( SessionStore.user.Profile == 'PR' || SessionStore.user.Profile == 'MDGPR') && eventService.hasSharedCalendar" (click)="changeProfile()" class="btn-no-color resize">
|
||||
<ion-icon class="right-icons d-md-none" src="assets/images/icons-profile-calendar-pr.svg"></ion-icon>
|
||||
</button>
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ export class MessageService {
|
||||
downloadAttachmentsTemp = 0;
|
||||
UploadAttachmentsTemp = 0;
|
||||
manualRetry = false
|
||||
origin: 'history' | 'stream' | 'local'
|
||||
|
||||
rowInstance: MessageModel
|
||||
|
||||
constructor(
|
||||
private NfService: NfService,
|
||||
@@ -72,7 +75,7 @@ export class MessageService {
|
||||
private ChatSystemService: ChatSystemService) {
|
||||
}
|
||||
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference = 'out-'+uuidv4() , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0 }:Message) {
|
||||
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference = 'out-'+uuidv4() , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0, origin }:Message) {
|
||||
|
||||
this.channels = channels || []
|
||||
this.mentions = mentions || []
|
||||
@@ -90,6 +93,7 @@ export class MessageService {
|
||||
this.delate = delate
|
||||
this.delateRequest = delateRequest
|
||||
this.sendAttempt = 0
|
||||
this.origin = origin
|
||||
|
||||
if(this.attachments?.length >= 1 && attachments?.length >= 1) {
|
||||
this.attachments[0] = Object.assign(this.attachments[0], attachments[0])
|
||||
@@ -257,6 +261,7 @@ export class MessageService {
|
||||
} catch (error) {
|
||||
this.uploadingFile = false
|
||||
this.errorUploadingAttachment = true
|
||||
this.UploadAttachmentsTemp++
|
||||
console.error('beforeSendAttachment error:', error)
|
||||
|
||||
}
|
||||
@@ -467,6 +472,7 @@ export class MessageService {
|
||||
u: this.u,
|
||||
_id: this._id,
|
||||
id: this.id,
|
||||
origin: this.origin,
|
||||
_updatedAt: this._updatedAt,
|
||||
messageSend: this.messageSend,
|
||||
offline: this.offline,
|
||||
@@ -489,6 +495,7 @@ export class MessageService {
|
||||
delete message.id
|
||||
const createdMessage = await MessageModel.create(message)
|
||||
|
||||
this.rowInstance = createdMessage
|
||||
this.id = createdMessage.id
|
||||
|
||||
if(this.earlySave) {
|
||||
@@ -497,8 +504,8 @@ export class MessageService {
|
||||
}
|
||||
}
|
||||
|
||||
async saveChanges() {
|
||||
|
||||
async getRowInstance () {
|
||||
|
||||
if(this.save) {
|
||||
const message = this.getChatObj()
|
||||
@@ -516,12 +523,29 @@ export class MessageService {
|
||||
a = await MessageModel.get({id: this.id})
|
||||
}
|
||||
|
||||
if(a) {
|
||||
for( const [name, value] of Object.entries(message)) {
|
||||
a[name] = value
|
||||
}
|
||||
await a.save()
|
||||
return a
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async saveChanges() {
|
||||
|
||||
if(!this.rowInstance) {
|
||||
this.rowInstance = await this.getRowInstance()
|
||||
}
|
||||
|
||||
if(this.save && this.rowInstance) {
|
||||
const message = this.getChatObj()
|
||||
|
||||
if(!message.id) {
|
||||
delete message.id
|
||||
}
|
||||
|
||||
for( const [name, value] of Object.entries(message)) {
|
||||
this.rowInstance[name] = value
|
||||
}
|
||||
|
||||
await this.rowInstance.save()
|
||||
|
||||
} else {
|
||||
this.earlySave = true
|
||||
|
||||
@@ -275,18 +275,25 @@ export class RoomService {
|
||||
if(message.fields.eventName == this.id+'/'+'typing') {
|
||||
|
||||
const args = message.fields.args
|
||||
|
||||
|
||||
if (typeof args[1] != 'object') {
|
||||
this.userThatIsTyping = this.usernameToDisplayName(args[0])
|
||||
|
||||
this.isTyping = args[1]
|
||||
this.otherUserType = args[1]
|
||||
this.readAllMessage()
|
||||
|
||||
const user = args[0]
|
||||
if(SessionStore.user.UserName != user) {
|
||||
this.readAllMessage()
|
||||
}
|
||||
|
||||
} else if(args[0]?.method == 'viewMessage' || args[1]?.method == 'viewMessage') {
|
||||
|
||||
this.readAllMessage()
|
||||
const user = args[0]
|
||||
|
||||
if(SessionStore.user.UserName != user) {
|
||||
this.readAllMessage()
|
||||
}
|
||||
|
||||
} else if(args[0]?.method == 'deleteMessage' || args[1]?.method == 'deleteMessage') {
|
||||
|
||||
this.deleteMessage(args[1]?.method?._id)
|
||||
@@ -295,7 +302,6 @@ export class RoomService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else if (message.fields.eventName == this.id+'/'+'deleteMessage') {}
|
||||
|
||||
})
|
||||
@@ -313,6 +319,7 @@ export class RoomService {
|
||||
|
||||
if(!found) {
|
||||
|
||||
ChatMessage.origin = 'stream'
|
||||
const message = await this.prepareCreate({message: ChatMessage, save: true});
|
||||
this.registerSendMessage(message)
|
||||
|
||||
@@ -556,7 +563,8 @@ export class RoomService {
|
||||
attachments,
|
||||
file,
|
||||
temporaryData,
|
||||
localReference
|
||||
localReference,
|
||||
origin: 'local'
|
||||
}
|
||||
|
||||
this.message= ''
|
||||
@@ -657,6 +665,7 @@ export class RoomService {
|
||||
// this.typing(this.message)
|
||||
this.chatOpen = true
|
||||
this.messageUnread = false
|
||||
this.sendReadMessage()
|
||||
}
|
||||
|
||||
|
||||
@@ -737,6 +746,7 @@ export class RoomService {
|
||||
|
||||
for(let message of chatHistory.result.messages.reverse()) {
|
||||
if (!messagesId.includes(message._id)) {
|
||||
message.origin = 'history'
|
||||
const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
|
||||
if(messagesToSave != null) {
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ export class ViewedMessageService {
|
||||
for(let id of membersIds) {
|
||||
if(message.addReceived(id)) {
|
||||
n++
|
||||
setTimeout(async() => {
|
||||
// setTimeout(async() => {
|
||||
await message.saveChanges()
|
||||
}, 100 * n)
|
||||
// }, 100 * n)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,9 +56,9 @@ export class ViewedMessageService {
|
||||
if(message.addViewed(id)) {
|
||||
message.addReceived(id)
|
||||
n++
|
||||
setTimeout(async() => {
|
||||
// setTimeout(async() => {
|
||||
await message.saveChanges()
|
||||
}, 100 * n)
|
||||
// }, 100 * n)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user