From 00d448c2314e819c4bf7cee4d8b4365b195cd249 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 5 Jan 2016 12:23:33 +0100 Subject: [PATCH] Fix displaying synced at time on the profile page --- app/services/auth.js | 18 +++++++++--------- app/templates/account.hbs | 23 ++--------------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/app/services/auth.js b/app/services/auth.js index 634a2dd6..dbea5d72 100644 --- a/app/services/auth.js +++ b/app/services/auth.js @@ -131,7 +131,7 @@ export default Ember.Service.extend({ } } if (user) { - return this.get('ajax').get("/users/" + user.id).then(() => { + return this.get('ajax').get("/users/" + user.id).then( (data) => { var userRecord; if (data.user.correct_scopes) { userRecord = this.loadUser(data.user); @@ -171,14 +171,14 @@ export default Ember.Service.extend({ }, loadUser(user) { - this.get('store').push({ - data: { - type: 'user', - id: user.id, - attributes: user - } - }); - return this.get('store').recordForId('user', user.id); + var store = this.get('store'), + adapter = store.adapterFor('user'), + userClass = store.modelFor('user'), + serializer = store.serializerFor('user'), + normalized = serializer.normalizeResponse(store, userClass, user, null, 'findRecord'); + + store.push(normalized); + return store.recordForId('user', user.id); }, receiveMessage(event) { diff --git a/app/templates/account.hbs b/app/templates/account.hbs index 558189bc..c68f5a7b 100644 --- a/app/templates/account.hbs +++ b/app/templates/account.hbs @@ -25,28 +25,9 @@

{{accountName}}

+ {{sync-button user=auth.currentUser}} + {{#if user.isSyncing}} -
- -
- {{else}} -
- -

last synced {{format-time user.syncedAt}}

-
{{#if config.pro}}

We're only showing your private repositories. You can find your public projects on travis-ci.org.

{{else}}