Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

Limit sidebar group list to groups the super admin is a real member of #358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ global.cobudgetApp.directive 'groupPageSidenav', () ->
$mdSidenav('left').open()

$scope.accessibleGroups = ->
CurrentUser() && CurrentUser().groups()
CurrentUser() && CurrentUser().groupsToDisplay()

$scope.redirectToGroupPage = (groupId) ->
if $state.current.name == 'group' && $scope.group.id == parseInt(groupId)
Expand Down
8 changes: 8 additions & 0 deletions app/models/user-model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ global.cobudgetApp.factory 'UserModel', (BaseModel) ->
@hasMany 'memberships', with: 'memberId'
@belongsTo 'subscriptionTracker'

groupsToDisplay: () ->
selectMemberships = _.filter @memberships(), (membership) ->
membership.id

groupIds = _.map selectMemberships, (membership) ->
membership.groupId
@recordStore.groups.find(groupIds)

groups: () ->
groupIds = _.map @memberships(), (membership) ->
membership.groupId
Expand Down