Fix getting push access data on settings reload

This commit is contained in:
Piotr Sarnacki 2015-09-07 13:21:57 +02:00
parent 1570935099
commit 13ce7f88bd
2 changed files with 10 additions and 3 deletions

View File

@ -54,6 +54,12 @@ User = Model.extend
permissions permissions
).property() ).property()
# TODO: permissions are loading asynchronously at the moment, so this should
# be the way to return them for all types:
pushPermissionsPromise: (->
@get('_rawPermissions').then (data) => data.pull
).property()
hasAccessToRepo: (repo) -> hasAccessToRepo: (repo) ->
id = if repo.get then repo.get('id') else repo id = if repo.get then repo.get('id') else repo

View File

@ -43,10 +43,11 @@ Route = TravisRoute.extend
); );
hasPushAccess: -> hasPushAccess: ->
repoId = parseInt @modelFor('repo').get('id') repoId = parseInt(@modelFor('repo').get('id'))
@auth.get('currentUser').get('pushPermissions').filter (item) -> @auth.get('currentUser').get('pushPermissionsPromise').then (permissions) ->
item == repoId permissions.filter (item) ->
item == repoId
model: () -> model: () ->
return Ember.RSVP.hash({ return Ember.RSVP.hash({