From b164e5f1a884906a4599bcd09c3dd9f298916749 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 6 Nov 2012 14:31:27 +0100 Subject: [PATCH] Load commit from build:started event payload Commit fields come in with build:started payload. We should split it into 2 separate keys in the payload, like: { build: { .... }, commit: { .... } } but I can't change pusher v1 API at the moment, due to backwards compatibility with the old client. We will be able to remove this manual extraction as soon as we switch to pusher v2 API. --- assets/scripts/app/store.coffee | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/assets/scripts/app/store.coffee b/assets/scripts/app/store.coffee index 9a5e780d..e8b45db0 100644 --- a/assets/scripts/app/store.coffee +++ b/assets/scripts/app/store.coffee @@ -67,11 +67,24 @@ Travis.Store = DS.Store.extend mappings = @adapter.get('mappings') type = mappings[name] - # TODO: we should definitely handle such things in some kind of adapters - # when we get 'commit' value, ember thinks that this is actually a commit object - # that it should sideload, let's just delete it for now if event == 'build:started' && data.build.commit + # TODO: commit should be a sideload record on build, not mixed with it + build = data.build + commit = { + id: build.commit_id + author_email: build.author_email + author_name: build.author_name + branch: build.branch + committed_at: build.committed_at + committer_email: build.committer_email + committer_name: build.committer_name + compare_url: build.compare_url + message: build.message + sha: build.commit + } delete(data.build.commit) + @loadIncomplete(Travis.Commit, commit) + if event == 'job:log' if job = @find(Travis.Job, data['job']['id'])