Skip to content

Commit

Permalink
Minor improvements and bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Lanzilotto committed Nov 6, 2024
1 parent 3be7ab4 commit fc110ef
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 71 deletions.
4 changes: 2 additions & 2 deletions src/app/bots/bots-list/bots-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,15 +791,15 @@ export class BotListComponent extends PricingBaseComponent implements OnInit, On

if (imageExists === true) {
self.botProfileImageExist = imageExists
self.logger.log('[BOTS-LIST] BOT PROFILE IMAGE (FAQ-COMP) - BOT PROFILE IMAGE EXIST ? ', imageExists, 'usecase native')
// console.log('[BOTS-LIST] BOT PROFILE IMAGE (FAQ-COMP) - BOT PROFILE IMAGE EXIST ? ', imageExists, 'usecase native')
bot.botImage = imageUrl + '&' + new Date().getTime();
// this.botProfileImageurl = this.sanitizer.bypassSecurityTrustUrl(_botProfileImageurl)
// self.setImageProfileUrl_Native(baseUrl)

} else {
self.botProfileImageExist = imageExists

self.logger.log('[CDS-CHATBOT-DTLS] BOT PROFILE IMAGE (FAQ-COMP) - BOT PROFILE IMAGE EXIST ? ', imageExists, 'usecase native')
// console.log('[CDS-CHATBOT-DTLS] BOT PROFILE IMAGE (FAQ-COMP) - BOT PROFILE IMAGE EXIST ? ', imageExists, 'usecase native')

}
})
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/sidebar/sidebar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<!-- ------------------------------------------- -->
<!-- CHAT -->
<!-- ------------------------------------------- -->
<div matTooltipClass="sb-mat-tooltip" matTooltip="Chat"
<div matTooltipClass="sb-mat-tooltip" matTooltip="Chat" style="position: relative;"
#tooltip="matTooltip" matTooltipPosition='right' matTooltipHideDelay="100">
<!-- <i class="material-icons sidebar-icons">chat</i> -->
<a id="openchat-a" #openchatbtn class="customAncor" target="_self" href="{{ CHAT_BASE_URL }}" (click)="openChat()">
Expand All @@ -72,8 +72,9 @@
c1.9,0,3.6-1.2,4.2-2.1c0.5,0.2,0.9,0.6,1.4,0.9C16.1,15.8,14,17.2,11.5,17.2z" />
</svg>
</span>

<span *ngIf="new_messages_count !== null && new_messages_count > 0 "
class="new-messages-count">{{new_messages_count}} </span>
class="new-messages-count"> {{new_messages_count}} </span>
</a>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/sidebar/sidebar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ button.close {
letter-spacing: 0px;
position: absolute;
right: 6px;
bottom: 9px;
bottom: 18px;
}


Expand Down
2 changes: 1 addition & 1 deletion src/app/services/upload-image-native.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class UploadImageNativeService {
// USE IMAGE API
const BASE_URL_IMAGES = this.BASE_URL + 'images'
return this._httpClient
.put<any>(BASE_URL_IMAGES + `/users/photo?force=true&user_id=${id}`, formData, requestOptions)
.put<any>(BASE_URL_IMAGES + `/users/photo?force=true&bot_id=${id}`, formData, requestOptions)
.pipe(map((res: any) => {
this.logger.log('[UPLOAD-IMAGE-NATIVE.SERV] UPLOAD BOT PHOTO PROFILE - RES ', res);
if (res && res.message) {
Expand Down
44 changes: 24 additions & 20 deletions src/app/services/websocket/ws-requests.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ export class WsRequestsService implements OnDestroy {
}
getStoredForegroungNotificationAndPublish() {
const foregrondNotificationsCount = +this.usersLocalDbService.getForegrondNotificationsCount();
// console.log('foregrondNotificationsCount ', foregrondNotificationsCount)
// this.logger.log('foregrondNotificationsCount ', foregrondNotificationsCount)
this.foregroundNotificationCount$.next(foregrondNotificationsCount)
}

publishAndStoreForegroundRequestCount(msgscount) {
// console.log('[WS-MSGS-SERV] - foreground Request Count ', msgscount)
// this.logger.log('[WS-MSGS-SERV] - foreground Request Count ', msgscount)
this.foregroundNotificationCount$.next(msgscount)
this.usersLocalDbService.storeForegrondNotificationsCount(msgscount)
}
Expand All @@ -165,16 +165,16 @@ export class WsRequestsService implements OnDestroy {
self.wsAllRequestsList = [];

this.auth.project_bs.subscribe((project) => {
// console.log('[WS-REQUESTS-SERV] - GET CURRENT PRJCT AND SUBSCRIBE TO WS-REQUESTS - PRJCT this.auth.project_bs.value', this.auth.project_bs.value)
// console.log('[WS-REQUESTS-SERV] - GET CURRENT PRJCT AND SUBSCRIBE TO WS-REQUESTS - PRJCT project', project)
// this.logger.log('[WS-REQUESTS-SERV] - GET CURRENT PRJCT AND SUBSCRIBE TO WS-REQUESTS - PRJCT this.auth.project_bs.value', this.auth.project_bs.value)
// this.logger.log('[WS-REQUESTS-SERV] - GET CURRENT PRJCT AND SUBSCRIBE TO WS-REQUESTS - PRJCT project', project)

// ---------------------------------------------------------------------------------
// Unsubscribe to websocket requests with the old project id
// ---------------------------------------------------------------------------------
if (this.project_id) {

// console.log('[WS-REQUESTS-SERV] - GET CURRENT PRJCT AND SUBSCRIBE TO WS-REQUESTS - ACTUALLY SUBSCRIBED TO THE REQUEST ID', this.subscribed_request_id)
// console.log('[WS-REQUESTS-SERV] - GET CURRENT PRJCT AND SUBSCRIBE TO WS-REQUESTS - UNSUBSCRIBE FROM OLD PROJECT-ID (REQUESTS - REQUEST-ID - MSGS - PRESENCE - AVAILABILITY)', this.project_id)
// this.logger.log('[WS-REQUESTS-SERV] - GET CURRENT PRJCT AND SUBSCRIBE TO WS-REQUESTS - ACTUALLY SUBSCRIBED TO THE REQUEST ID', this.subscribed_request_id)
// this.logger.log('[WS-REQUESTS-SERV] - GET CURRENT PRJCT AND SUBSCRIBE TO WS-REQUESTS - UNSUBSCRIBE FROM OLD PROJECT-ID (REQUESTS - REQUEST-ID - MSGS - PRESENCE - AVAILABILITY)', this.project_id)

this.webSocketJs.unsubscribe('/' + this.project_id + '/requests');

Expand Down Expand Up @@ -297,7 +297,7 @@ export class WsRequestsService implements OnDestroy {
// Update
}, function (data, notification) {

// console.log("[WS-REQUESTS-SERV] DSHB - UPDATE - DATA ", data);
// this.logger.log("[WS-REQUESTS-SERV] DSHB - UPDATE - DATA ", data);

self.wsConv$.next(data)

Expand All @@ -318,17 +318,17 @@ export class WsRequestsService implements OnDestroy {

}, function (data, notification) {
self.logger.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA ", data);
// console.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA ", data);
// this.logger.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA ", data);
self.logger.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - NOTIFICATION ", notification);
// self.wsConvData$.next(data)

// if (notification.event.method === 'CREATE') {

// self.wsRequestsList.push(data[0]);
// console.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA data published ", self.wsRequestsList);
// this.logger.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA data published ", self.wsRequestsList);

// self.wsRequestsList$.next(data);
// console.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA data published ", data);
// this.logger.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA data published ", data);

// if (data) {
// if (Array.isArray(data)) {
Expand All @@ -350,12 +350,12 @@ export class WsRequestsService implements OnDestroy {
// -------------------------------
// let wsOnDataConvsList = [];
// wsOnDataConvsList.push(data)
// console.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA wsOnDataConvsList ", wsOnDataConvsList);
// this.logger.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA wsOnDataConvsList ", wsOnDataConvsList);
// // if (wsOnDataRequestsList.length > 0) {
// let wsOnDataConvsUnserved = wsOnDataConvsList[0].filter((el) => {
// return el.status === 100;
// });
// console.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA ONLY UNSERVED ", wsOnDataConvsUnserved);
// this.logger.log("[WS-REQUESTS-SERV] DSHB - ON-DATA - DATA ONLY UNSERVED ", wsOnDataConvsUnserved);
// self.wsOnDataUnservedConvs$.next(wsOnDataConvsUnserved);
// }
// }
Expand Down Expand Up @@ -468,7 +468,7 @@ export class WsRequestsService implements OnDestroy {
}

unsubscribePreviousRequestId() {
// console.log('[WS-REQUESTS-SERV] UNSUBSCRIBE TO PREVIOUS REQUEST ID ', this.subscribed_request_id)
// this.logger.log('[WS-REQUESTS-SERV] UNSUBSCRIBE TO PREVIOUS REQUEST ID ', this.subscribed_request_id)

if (this.subscribed_request_id) {
this.webSocketJs.unsubscribe('/' + this.project_id + '/requests/' + this.subscribed_request_id);
Expand All @@ -486,7 +486,7 @@ export class WsRequestsService implements OnDestroy {
* @param id_request
*/
subscribeTo_wsRequestById(id_request) {
// console.log("[WS-REQUESTS-SERV] - SUBSCR TO WS REQUEST-BY-ID (REF) id_request ", id_request);
// this.logger.log("[WS-REQUESTS-SERV] - SUBSCR TO WS REQUEST-BY-ID (REF) id_request ", id_request);

this.unsubscribePreviousRequestId()

Expand Down Expand Up @@ -550,7 +550,7 @@ export class WsRequestsService implements OnDestroy {
*/
unsubscribeTo_wsRequestById(id_request) {
this.webSocketJs.unsubscribe('/' + this.project_id + '/requests/' + id_request);
// console.log("[WS-REQUESTS-SERV] - UNSUBSCRIBE REQUEST-BY-ID FROM WS request_id ", id_request, ' project_id ', this.project_id);
// this.logger.log("[WS-REQUESTS-SERV] - UNSUBSCRIBE REQUEST-BY-ID FROM WS request_id ", id_request, ' project_id ', this.project_id);
}


Expand All @@ -563,7 +563,7 @@ export class WsRequestsService implements OnDestroy {

const path = '/' + this.project_id + '/project_users/users/' + requesterid;

// console.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE PATH ", path);
// this.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE PATH ", path);

this.webSocketJs.ref(path, 'subscribeToWS_RequesterPresence',

Expand Down Expand Up @@ -968,7 +968,7 @@ export class WsRequestsService implements OnDestroy {
};

const url = this.SERVER_BASE_PATH + this.project_id + '/requests/' + request_id + '/followers/' + projectuserid
// console.log('[WS-REQUESTS-SERV] - REMOVE FOLLOWER URL ', url);
// this.logger.log('[WS-REQUESTS-SERV] - REMOVE FOLLOWER URL ', url);

return this._httpClient
.delete(url, httpOptions)
Expand Down Expand Up @@ -1006,7 +1006,7 @@ export class WsRequestsService implements OnDestroy {
// https://tiledesk-server-pre.herokuapp.com/public/requests/support-group-62e26b1324bc4200357b1a3c-0930f905800f4c62b6bac937d6beb568/messages.csv
public exportTranscriptAsCSVFile(idrequest: any) {
const url = this.SERVER_BASE_PATH + 'public/requests/' + idrequest + '/messages.csv';
// console.log('DOWNLOAD TRANSCRIPT AS CSV URL ', url);
// this.logger.log('DOWNLOAD TRANSCRIPT AS CSV URL ', url);

const httpOptions = {
headers: new HttpHeaders({
Expand Down Expand Up @@ -1209,7 +1209,7 @@ export class WsRequestsService implements OnDestroy {

// const url = this.SERVER_BASE_PATH + 'modules/tilebot/ext/parameters/requests/' + id_request;
const url = this.SERVER_BASE_PATH + this.project_id + '/requests/' + id_request + '/chatbot/parameters';
// console.log('[WS-REQUESTS-SERV] - GET CONVERSATION WITH BOT URL ', url);
// this.logger.log('[WS-REQUESTS-SERV] - GET CONVERSATION WITH BOT URL ', url);

// 'Authorization': this.TOKEN,
const httpOptions = {
Expand Down Expand Up @@ -1264,9 +1264,13 @@ export class WsRequestsService implements OnDestroy {
operator = '='
}

if (status === '150' ) {
operator = '='
}

let _querystring = ''
if (querystring && querystring !== undefined) {
if (status === '100' || status === '200' || status === '1000' || status === '50' || status ==="1000,100,200" || status ==="100,150,200" || statuses?.length>0) {
if (status === '100' || status === '200' || status === '1000' || status === '150' || status ==="1000,100,200" || status ==="100,150,200" || statuses?.length>0) {
_querystring = '&' + querystring
this.logger.log('[WS-REQUESTS-SERV][HISTORY & NORT-CONVS] - *** REQUESTS SERVICE HERE 1');
} else if (status === 'all') {
Expand Down
6 changes: 3 additions & 3 deletions src/app/users/users.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,23 +238,23 @@
<!-- USECASE uploadEngine Firebase class="user-img-in-teammates-list" -->
<!-- --------------------------------------------------- -->
<!-- projectUser?.hasImage && onerror="this.src='assets/img/no_image_user.png'"-->
<img id="img-{{projectUser?.id_user?._id}}" *ngIf="UPLOAD_ENGINE_IS_FIREBASE"
<img *ngIf="projectUser?.hasImage === true && UPLOAD_ENGINE_IS_FIREBASE" id="img-{{projectUser?.id_user?._id}}"
src="https://firebasestorage.googleapis.com/v0/b/{{storageBucket}}/o/profiles%2F{{projectUser?.id_user?._id}}%2Fphoto.jpg?alt=media"
onerror="this.src='assets/img/no_image_user_2.png'"/>

<!-- --------------------------------------------------- -->
<!-- USECASE uploadEngine Native class="user-img-in-teammates-list" -->
<!-- --------------------------------------------------- -->
<!-- projectUser?.hasImage && onerror="this.src='assets/img/no_image_user.png'"-->
<img id="img-{{projectUser?.id_user?._id}}" *ngIf=" !UPLOAD_ENGINE_IS_FIREBASE"
<img *ngIf="projectUser?.hasImage === true && !UPLOAD_ENGINE_IS_FIREBASE" id="img-{{projectUser?.id_user?._id}}"
src="{{baseUrl}}images?path=uploads%2Fusers%2F{{projectUser?.id_user?._id}}%2Fimages%2Fthumbnails_200_200-photo.jpg"
onerror="this.src='assets/img/no_image_user_2.png'"/>

<!-- --------------------------------------------------- -->
<!-- USECASE No profile Image -->
<!-- --------------------------------------------------- -->
<!-- *ngIf="projectUser?.hasImage === false" [ngStyle]="{'display': displayAvatarNoProfileFoto }" -->
<div class="avatar-no-profile-photo"
<div *ngIf="projectUser?.hasImage === false" class="avatar-no-profile-photo"
[ngStyle]="{'background': 'linear-gradient(rgb(255,255,255) -125%,' + projectUser?.id_user?.fillColour + ')'}">
<span class="altenative-projetuser-avatar">
{{ projectUser?.id_user?.fullname_initial }}
Expand Down
36 changes: 18 additions & 18 deletions src/app/users/users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,24 +624,24 @@ export class UsersComponent extends PricingBaseComponent implements OnInit, Afte
// users_id_array.push(_user_id);
// this.logger.log('[USERS] - PROJECT-USER - users_id_array', users_id_array)

// let imgUrl = ''
// if (this.appConfigService.getConfig().uploadEngine === 'firebase') {
// imgUrl = 'https://firebasestorage.googleapis.com/v0/b/' + storage + '/o/profiles%2F' + projectuser['id_user']['_id'] + '%2Fphoto.jpg?alt=media'
// // this.logger.log('[USERS] - PROJECT USERS imgUrl (usecase firebase)', imgUrl);
// } else {
// imgUrl = storage + 'images?path=uploads%2Fusers%2F' + projectuser['id_user']['_id'] + '%2Fimages%2Fthumbnails_200_200-photo.jpg'
// // this.logger.log('[USERS] - PROJECT USERS imgUrl (usecase native)', imgUrl);
// }

// this.checkImageExists(imgUrl, (existsImage) => {
// if (existsImage == true) {
// this.logger.log('[USERS] - IMAGE EXIST X PROJECT USERS', projectuser)
// projectuser.hasImage = true
// } else {
// this.logger.log('[USERS] - IMAGE NOT EXIST X PROJECT USERS', projectuser)
// projectuser.hasImage = false
// }
// })
let imgUrl = ''
if (this.appConfigService.getConfig().uploadEngine === 'firebase') {
imgUrl = 'https://firebasestorage.googleapis.com/v0/b/' + storage + '/o/profiles%2F' + projectuser['id_user']['_id'] + '%2Fphoto.jpg?alt=media'
// this.logger.log('[USERS] - PROJECT USERS imgUrl (usecase firebase)', imgUrl);
} else {
imgUrl = storage + 'images?path=uploads%2Fusers%2F' + projectuser['id_user']['_id'] + '%2Fimages%2Fthumbnails_200_200-photo.jpg'
// this.logger.log('[USERS] - PROJECT USERS imgUrl (usecase native)', imgUrl);
}

this.checkImageExists(imgUrl, (existsImage) => {
if (existsImage == true) {
this.logger.log('[USERS] - IMAGE EXIST X PROJECT USERS', projectuser)
projectuser.hasImage = true
} else {
this.logger.log('[USERS] - IMAGE NOT EXIST X PROJECT USERS', projectuser)
projectuser.hasImage = false
}
})

if (projectuser && projectuser['id_user']) {
this.createProjectUserAvatar(projectuser['id_user'])
Expand Down
Loading

0 comments on commit fc110ef

Please sign in to comment.