We can get push access info from current user record

This commit is contained in:
Piotr Sarnacki 2015-08-07 13:05:14 +02:00
parent 8e5d40029a
commit e382d3015d

View File

@ -44,21 +44,9 @@ Route = TravisRoute.extend
hasPushAccess: ->
repoId = parseInt @modelFor('repo').get('id')
pushAccess = true
Ajax.get '/users/permissions', (data) =>
admin = data.admin.filter (item) ->
return item == repoId
push = data.push.filter (item) ->
return item == repoId
pull = data.pull.filter (item) ->
return item == repoId
if Ember.isEmpty admin && Ember.isEmpty push && !Ember.isEmpty pull
pushAccess = false
pushAccess
@auth.get('currentUser').get('pushPermissions').filter (item) ->
item == repoId
model: () ->
return Ember.RSVP.hash({