Skip to content

Commit

Permalink
Merge pull request travis-ci#427 from travis-ci/fix-displaying-last-s…
Browse files Browse the repository at this point in the history
…ynced-at

Fix displaying synced at time on the profile page
  • Loading branch information
drogus committed Jan 5, 2016
2 parents 341296a + 00d448c commit f4aa705
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 30 deletions.
18 changes: 9 additions & 9 deletions app/services/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
23 changes: 2 additions & 21 deletions app/templates/account.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,9 @@
<h1>{{accountName}}</h1>
</div>

{{sync-button user=auth.currentUser}}

{{#if user.isSyncing}}
<div class="sync-button">
<button class="button is-syncing">
<span class="loading-indicator--white"><i></i><i></i><i></i></span>Syncing from GitHub
</button>
</div>
{{else}}
<div class="sync-button">
<button {{action 'sync'}} class="button">
<span class="icon">
<svg x="0px" y="0px" viewBox="1 1 17 17" xml:space="preserve">
<g id="Trigger">
<path fill="#A7AEAE" d="M17.2,7.9C17,7.6,16.6,7.7,16.3,8l-1,1.2C14.9,6,12.2,3.6,9,3.6c-3.6,0-6.4,2.9-6.4,6.4s2.9,6.4,6.4,6.4
c1.8,0,3.6-0.8,4.8-2.2c0.2-0.3,0.2-0.7-0.1-0.9c-0.3-0.2-0.7-0.2-0.9,0.1c-1,1.1-2.4,1.7-3.9,1.7c-2.8,0-5.1-2.3-5.1-5.1
S6.1,4.9,9,4.9c2.7,0,4.9,2.1,5.1,4.7l-1.7-1.1c-0.3-0.2-0.7-0.1-0.9,0.2s-0.1,0.7,0.2,0.9l2.8,1.8c0,0,0,0,0,0
c0.1,0.1,0.2,0.1,0.3,0.1c0.1,0,0.2,0,0.3-0.1c0,0,0.1,0,0.1-0.1c0,0,0.1-0.1,0.1-0.1l2-2.4C17.6,8.5,17.5,8.1,17.2,7.9z"/>
</g>
</svg>
</span>Sync
</button>
<p class="sync-last">last synced {{format-time user.syncedAt}}</p>
</div>
{{#if config.pro}}
<p>We're only showing your private repositories. You can find your public projects on <a href="https://travis-ci.org" title="travis-ci.org">travis-ci.org</a>.</p>
{{else}}
Expand Down

0 comments on commit f4aa705

Please sign in to comment.