Merge pull request #4399 from mabashian/3676-notif-menu

Show notification menu to users with notification_admin team role

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-07-30 22:46:07 +00:00 committed by GitHub
commit 4a35df9a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -61,8 +61,8 @@ function AtLayoutController ($scope, $http, strings, ProcessErrors, $transitions
}
function checkNotificationAdmin () {
const usersPath = `/api/v2/users/${vm.currentUserId}/roles/?role_field=notification_admin_role`;
$http.get(usersPath)
const notifAdminOrgsPath = 'api/v2/organizations/?role_level=notification_admin_role';
$http.get(notifAdminOrgsPath)
.then(({ data }) => {
if (data.count > 0) {
vm.isNotificationAdmin = true;
@ -73,7 +73,7 @@ function AtLayoutController ($scope, $http, strings, ProcessErrors, $transitions
.catch(({ data, status }) => {
ProcessErrors(null, data, status, null, {
hdr: strings.get('error.HEADER'),
msg: strings.get('error.CALL', { path: usersPath, action: 'GET', status })
msg: strings.get('error.CALL', { path: notifAdminOrgsPath, action: 'GET', status })
});
});
}

View File

@ -46,7 +46,7 @@ describe('Components | Layout', () => {
$httpBackend.when('GET', /admin_of_organizations/)
.respond(mockOrgAdminResponse);
$httpBackend.when('GET', /roles\/\?role_field=notification_admin_role/)
$httpBackend.when('GET', /organizations\/\?role_level=notification_admin_role/)
.respond(mockNotificationAdminResponse);
});