This commit is contained in:
Peter Maquiran
2023-01-12 15:27:09 +01:00
parent 58f9e7eacd
commit 9493179efd
82 changed files with 702 additions and 557 deletions
+19 -14
View File
@@ -100,6 +100,8 @@ export class AuthService {
session.BasicAuthKey = user.BasicAuthKey
SessionStore.reset(session)
console.log(session)
return true;
}
@@ -109,23 +111,26 @@ export class AuthService {
loginToChatWs() {
setTimeout(() => {
this.RochetChatConnectorService.connect();
this.RochetChatConnectorService.login().then((message: any) => {
SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save()
if(SessionStore.user.ChatData?.data) {
this.RochetChatConnectorService.connect();
this.RochetChatConnectorService.login().then((message: any) => {
SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save()
this.RochetChatConnectorService.setStatus('online')
window['RochetChatConnectorService'] = this.RochetChatConnectorService
setTimeout(() => {
this.ChatSystemService.getAllRooms();
this.RochetChatConnectorService.setStatus('online')
}, 200);
window['RochetChatConnectorService'] = this.RochetChatConnectorService
setTimeout(() => {
this.ChatSystemService.getAllRooms();
this.RochetChatConnectorService.setStatus('online')
}, 200);
}).catch((error) => {
console.error(error)
})
}).catch((error) => {
console.error(SessionStore.user.ChatData, 'web socket login',error)
})
}
// before sending a message with a attachment
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ChangeMessageQueueService } from './change-message-queue.service';
describe('ChangeMessageQueueService', () => {
let service: ChangeMessageQueueService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChangeMessageQueueService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,8 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ChangeMessageQueueService {
constructor() {}
}
+11 -6
View File
@@ -504,20 +504,25 @@ export class MessageService {
const message = this.getChatObj()
let a
if(!message.id) {
delete message.id
}
if (this.localReference) {
a = await MessageModel.get({localReference: this.localReference})
} else if (this._id) {
a = await MessageModel.get({id: this.id})
} else if(this.id) {
a = await MessageModel.get({_id: this._id})
} else if(this.id) {
a = await MessageModel.get({id: this.id})
}
for( const [name, value] of Object.entries(message)) {
a[name] = value
if(a) {
for( const [name, value] of Object.entries(message)) {
a[name] = value
}
await a.save()
}
await a.save()
} else {
this.earlySave = true
console.log('save change to early')
-2
View File
@@ -763,8 +763,6 @@ export class RoomService {
}
async readAllMessage() {
this.ViewedMessageService.requestReadAll(this)
@@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import * as FIFOProcessQueue from 'fifo-process-queue';
import { async } from 'rxjs';
import { RoomService } from './room.service';
@Injectable({
+15 -1
View File
@@ -63,6 +63,7 @@ export class EventsService {
calendarNamesType = {}
myCalendarNames = {}
hasAnyCalendar = false
constructor(
private http: HttpClient,
@@ -135,6 +136,7 @@ export class EventsService {
if (this.loggeduser.Profile == 'MDGPR') {
for (let calendar of this.loggeduser.OwnerCalendars) {
this.hasAnyCalendar = false
if (calendar.CalendarName == 'Oficial') {
@@ -157,6 +159,7 @@ export class EventsService {
}
for (let sharedCalendar of this.loggeduser.SharedCalendars) {
this.hasAnyCalendar = false
if (sharedCalendar.CalendarName == 'Oficial') {
@@ -181,6 +184,7 @@ export class EventsService {
else if (this.loggeduser.Profile == 'PR') {
for (let calendar of this.loggeduser.OwnerCalendars) {
this.hasAnyCalendar = false
if (calendar.CalendarName == 'Oficial') {
this.hasOwnOficial = true
@@ -203,6 +207,7 @@ export class EventsService {
}
for (let calendar of this.loggeduser.OwnerCalendars) {
this.hasAnyCalendar = false
if(!this.usersCalendarIds.includes(calendar.OwnerUserId)) {
this.usersCalendarIds.push(calendar.OwnerUserId)
}
@@ -234,7 +239,7 @@ export class EventsService {
}
for (let sharedCalendar of this.loggeduser.SharedCalendars) {
this.hasAnyCalendar = false
if(!this.usersCalendarIds.includes(sharedCalendar.OwnerUserId)) {
this.usersCalendarIds.push(sharedCalendar.OwnerUserId)
@@ -267,6 +272,7 @@ export class EventsService {
for (let sharedCalendar of this.loggeduser.SharedCalendars) {
this.hasAnyCalendar = false
if(sharedCalendar?.OwnerUserId) {
this.GetCalendarName(sharedCalendar.OwnerUserId).subscribe((e)=> {
this.calendarNames[sharedCalendar.CalendarId] = e.FullName
@@ -286,6 +292,7 @@ export class EventsService {
}
for (let sharedCalendar of this.loggeduser.OwnerCalendars) {
this.hasAnyCalendar = false
this.calendarNames[sharedCalendar.CalendarId] = 'Meu calendario'
@@ -297,6 +304,13 @@ export class EventsService {
this.calendarNamesType['Meu calendario'][sharedCalendar.CalendarName] = true
this.calendarNamesType['Meu calendario'][sharedCalendar.CalendarName+'Id'] = sharedCalendar.CalendarId
}
if(SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
this.hasAnyCalendar = false
} else {
this.hasAnyCalendar = true
}
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ export class InativityService {
function resetTimer() {
clearTimeout(time);
time = setTimeout(userIsNotActive, 60000 * 5); // time is in milliseconds
time = setTimeout(userIsNotActive, 60000 * 15); // time is in milliseconds
}
}
}
+4 -2
View File
@@ -28,8 +28,10 @@ export class PermissionService {
for(let permission of (this.SessionStore.user.UserPermissions || [])) {
if (args.includes(permission)) {
return true;
for( const arg of args ) {
if (arg == permission) {
return true;
}
}
}
return false;
+1 -1
View File
@@ -16,7 +16,7 @@ const { Storage } = Plugins; */
) {}
key(key:string): string {
return (SHA1('service'+this.constructor.name+key)).toString()
return (SHA1('service'+"StorageService"+key)).toString()
}
async keyExist(key:string) {
+1 -1
View File
@@ -21,7 +21,7 @@ export class ThemeService {
private storageservice: StorageService
) {
this.keyName = (SHA1(this.constructor.name)).toString()
this.keyName = (SHA1("ThemeService")).toString()
let restore = localstoreService.get(this.keyName, {
theme: this.defaultTheme
})