FIX: Don't update `cooked` when a like is received.
This commit is contained in:
parent
616e1dcd16
commit
28c59d754b
|
@ -891,7 +891,11 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||||
|
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case "acted":
|
case "acted":
|
||||||
postStream.triggerChangedPost(data.id, data.updated_at).then(() => refresh({ id: data.id, refreshLikes: true }));
|
postStream.triggerChangedPost(
|
||||||
|
data.id,
|
||||||
|
data.updated_at,
|
||||||
|
{ preserveCooked: true }
|
||||||
|
).then(() => refresh({ id: data.id, refreshLikes: true }));
|
||||||
break;
|
break;
|
||||||
case "revised":
|
case "revised":
|
||||||
case "rebaked": {
|
case "rebaked": {
|
||||||
|
|
|
@ -544,7 +544,9 @@ export default RestModel.extend({
|
||||||
return Ember.RSVP.Promise.resolve();
|
return Ember.RSVP.Promise.resolve();
|
||||||
},
|
},
|
||||||
|
|
||||||
triggerChangedPost(postId, updatedAt) {
|
triggerChangedPost(postId, updatedAt, opts) {
|
||||||
|
opts = opts || {};
|
||||||
|
|
||||||
const resolved = Ember.RSVP.Promise.resolve();
|
const resolved = Ember.RSVP.Promise.resolve();
|
||||||
if (!postId) { return resolved; }
|
if (!postId) { return resolved; }
|
||||||
|
|
||||||
|
@ -552,7 +554,13 @@ export default RestModel.extend({
|
||||||
if (existing && existing.updated_at !== updatedAt) {
|
if (existing && existing.updated_at !== updatedAt) {
|
||||||
const url = "/posts/" + postId;
|
const url = "/posts/" + postId;
|
||||||
const store = this.store;
|
const store = this.store;
|
||||||
return ajax(url).then(p => this.storePost(store.createRecord('post', p)));
|
return ajax(url).then(p => {
|
||||||
|
if (opts.preserveCooked) {
|
||||||
|
p.cooked = existing.get('cooked');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.storePost(store.createRecord('post', p));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return resolved;
|
return resolved;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue