From 34e53c1034e0e8546671cdfc25feebf79f29f2da Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 11 Nov 2015 14:50:43 +0100 Subject: [PATCH] Fix job route's use of job.build relationship build is an async relationship now, so job.get('build') returns a promise. --- app/routes/job.coffee | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/routes/job.coffee b/app/routes/job.coffee index e207df5f..e6320fa8 100644 --- a/app/routes/job.coffee +++ b/app/routes/job.coffee @@ -18,16 +18,18 @@ Route = TravisRoute.extend @controllerFor('job').set('job', model) repo.activate('job') - if build = model.get('build') - build = @store.recordForId('build', build.get('id')) - buildController = @controllerFor('build') + buildController = @controllerFor('build') - # this is a hack to not set favicon changes from build - # controller while we're viewing job, this should go away - # after refactoring of controllers - buildController.set('sendFaviconStateChanges', false) + model.get('repo') + if buildPromise = model.get('build') + buildPromise.then (build) => + build = @store.recordForId('build', build.get('id')) + buildController.set('build', build) - buildController.set('build', build) + # this is a hack to not set favicon changes from build + # controller while we're viewing job, this should go away + # after refactoring of controllers + buildController.set('sendFaviconStateChanges', false) model: (params) -> @store.find('job', params.job_id)