FIX: don't stop youtube when liking a post
Also fixes post action create/destroy api not to include post raw.
This commit is contained in:
parent
c43f6455f2
commit
e14e8f64bc
|
@ -327,12 +327,24 @@ Discourse.Post = Discourse.Model.extend({
|
|||
updateFromJson: function(obj) {
|
||||
if (!obj) return;
|
||||
|
||||
var skip, oldVal;
|
||||
|
||||
// Update all the properties
|
||||
var post = this;
|
||||
_.each(obj, function(val,key) {
|
||||
if (key !== 'actions_summary'){
|
||||
if (val) {
|
||||
post.set(key, val);
|
||||
oldVal = post[key];
|
||||
skip = false;
|
||||
|
||||
if (val && val !== oldVal) {
|
||||
|
||||
if (key === "reply_to_user" && val && oldVal) {
|
||||
skip = val.username === oldVal.username || Em.get(val, "username") === Em.get(oldVal, "username");
|
||||
}
|
||||
|
||||
if(!skip) {
|
||||
post.set(key, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -355,9 +355,9 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
protected
|
||||
|
||||
def render_post_json(post)
|
||||
def render_post_json(post, add_raw=true)
|
||||
post_serializer = PostSerializer.new(post, scope: guardian, root: false)
|
||||
post_serializer.add_raw = true
|
||||
post_serializer.add_raw = add_raw
|
||||
post_serializer.topic_slug = post.topic.slug if post.topic.present?
|
||||
|
||||
counts = PostAction.counts_for([post], current_user)
|
||||
|
|
|
@ -22,7 +22,7 @@ class PostActionsController < ApplicationController
|
|||
else
|
||||
# We need to reload or otherwise we are showing the old values on the front end
|
||||
@post.reload
|
||||
render_post_json(@post)
|
||||
render_post_json(@post, _add_raw = false)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ class PostActionsController < ApplicationController
|
|||
PostAction.remove_act(current_user, @post, post_action.post_action_type_id)
|
||||
|
||||
@post.reload
|
||||
render_post_json(@post)
|
||||
render_post_json(@post, _add_raw = false)
|
||||
end
|
||||
|
||||
def defer_flags
|
||||
|
|
Loading…
Reference in New Issue