58 |
58 |
this.user = user;
|
59 |
59 |
if (this.user) {
|
60 |
60 |
this.userEmail = this.user.email;
|
61 |
|
this.subscriptions.push(this._manageUserNotificationsService.getUserNotifications(this.properties, this.communityId, this.userEmail).subscribe(
|
|
61 |
this.subscriptions.push(this._manageUserNotificationsService.getUserNotifications(this.properties, this.communityId).subscribe(
|
62 |
62 |
userNotifications => {
|
63 |
63 |
this.initialUserNotifications = userNotifications;
|
64 |
64 |
if (this.initialUserNotifications['notifyForNewManagers'] == null ||
|
65 |
65 |
this.initialUserNotifications['notifyForNewSubscribers'] == null) {
|
66 |
66 |
if(Session.isManager("community",this.communityId, this.user)) {
|
67 |
|
this.initialUserNotifications = new UserNotificationsRights(true, true, this.userEmail);
|
|
67 |
this.initialUserNotifications = new UserNotificationsRights(true, true, "");
|
68 |
68 |
}else{
|
69 |
|
this.initialUserNotifications = new UserNotificationsRights(false, false, this.userEmail);
|
|
69 |
this.initialUserNotifications = new UserNotificationsRights(false, false, "");
|
70 |
70 |
}
|
71 |
71 |
}
|
72 |
72 |
|
... | ... | |
76 |
76 |
error => {
|
77 |
77 |
if (error.status === 404) {
|
78 |
78 |
if(Session.isManager("community",this.communityId, this.user)) {
|
79 |
|
this.initialUserNotifications = new UserNotificationsRights(true, true, this.userEmail);
|
|
79 |
this.initialUserNotifications = new UserNotificationsRights(true, true, "");
|
80 |
80 |
}else{
|
81 |
|
this.initialUserNotifications = new UserNotificationsRights(false, false, this.userEmail);
|
|
81 |
this.initialUserNotifications = new UserNotificationsRights(false, false, "");
|
82 |
82 |
}
|
83 |
83 |
this.userNotifications = JSON.parse(JSON.stringify(this.initialUserNotifications));
|
84 |
84 |
} else {
|
... | ... | |
163 |
163 |
|
164 |
164 |
if (this.userNotifications.managerEmail) {
|
165 |
165 |
userNotifications['managerEmail'] = this.userNotifications.managerEmail;
|
166 |
|
} else {
|
167 |
|
if (this.user) {
|
168 |
|
userNotifications['managerEmail'] = this.user.email;
|
169 |
|
}
|
170 |
166 |
}
|
|
167 |
// else {
|
|
168 |
// if (this.user) {
|
|
169 |
// userNotifications['managerEmail'] = this.user.email;
|
|
170 |
// }
|
|
171 |
// }
|
171 |
172 |
return userNotifications;
|
172 |
173 |
}
|
173 |
174 |
|
[branch new-UI | Admin Portal]:
1. manage-user-notifications.components.ts: Do not set "email" from user.email to send it to services and requests - email is set in back end for current user.
2. manage-user-notifications.service.ts: In method "getUserNotifications()", do not parse notifications to get current user's - API returns notifications only for the current user, not all users.