Skip to content

Commit

Permalink
Merge pull request #40 from kadirahq/fix-39
Browse files Browse the repository at this point in the history
Add the user to the local cache when adding a comment.
  • Loading branch information
arunoda authored Oct 14, 2016
2 parents 15bcad7 + 8688d98 commit c3b42da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/manager/containers/CommentsPanel/dataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ export default class DataStore {
return Promise.resolve(null);
}

// add user to the local cache
this.users[this.user.id] = this.user;

// add user to the actual collection
return this.db.getCollection('users').set(this.user);
}

Expand All @@ -184,8 +188,8 @@ export default class DataStore {
}

addComment(comment) {
this._addPendingComment(comment)
.then(() => this._addAuthorToTheDatabase())
this._addAuthorToTheDatabase()
.then(() => this._addPendingComment(comment))
.then(() => this._addCommentToDatabase(comment))
.then(() => this._loadUsers())
.then(() => this._loadComments());
Expand Down

0 comments on commit c3b42da

Please sign in to comment.