触发FB.Event.subscribe("comment.create"),但回复时首次评论成功时返回500 [英] FB.Event.subscribe("comment.create") fires but returns 500 when commenting first successful when replying

查看:85
本文介绍了触发FB.Event.subscribe("comment.create"),但回复时首次评论成功时返回500的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FB注释插件给出500错误.触发FB.Event.Subscribe("comment.create',callback),但未成功返回,而是引发500错误.但是,这仅在第一个评论中发生.该帖子仍会继续浏览,并在重新加载页面时显示为评论.

FB comment plugin gives 500 error. FB.Event.Subscribe("comment.create',callback) is fired but does not return successfully instead throws a 500 error.However,this only happens on the first comment.The post still goes through and appears as comment on page reload.

但是,在同一则帖子上,当回复已发布的评论时,它会触发事件而不会出现任何错误.

However,on the same post,when replying to the posted comment,it fires the event without any errors.

我正在使用facebook comment插件,我的设置是我通过从数据库中获取数据来创建动态url,然后在前端基于该URL创建url.我在前端使用了剔除功能,在后端使用了flask.我们的目标是利用FB评论插件作为每个帖子的主题评论.当有人通过查看帖子的ID对帖子发表评论时,我会触发推送通知.

I am using facebook comment plugin and my setup is that i create dynamic url by getting data from the database and then create url based on that on front end.I am using knockout on the front end and flask at the backend.My goal here is to utilise FB comment plugin as threaded comment on each post.I am triggering push notifications when someone comments on the post by looking at the id of the post.

//HTML
<div data-bind="text:$data.location, 
click:window.animateMarkerOnClick.bind($data), attr: { id: 
$data.key,class:'search-list' }"></div>
<div id="listing-msg" > 
</div>
<div class="fb-comments" data-bind='attr:{"href": 
"http://localhost:8080/postit/get_share_listings/#" + 
$data.key,"id":$data.key}' data-width="320" data-numposts="1" data- 
colorscheme = "dark" notify = "true" data-order-by = "reverse_time"></div>

//JS EVENT SUBSCRIPTION
window.fbAsyncInit = function() {
    FB.init({
      appId            : 'xxxxxxx',
      autoLogAppEvents : true,
      xfbml            : true,
      version          : 'v3.2'
    });
  FB.Event.subscribe("comment.create", push)

};

 (function(d, s, id){
 var js, fjs = d.getElementsByTagName(s)[0];
 if (d.getElementById(id)) {return;}
 js = d.createElement(s); js.id = id;
 js.src = "https://connect.facebook.net/en_US/sdk.js";
 fjs.parentNode.insertBefore(js, fjs);

}(文档,脚本","facebook-jssdk"));

}(document, 'script', 'facebook-jssdk'));

//callback
function push(){
$.ajax({
     type: "POST",
     url: "http://localhost:8080/postit/push",
     contentType: 'application/json;charset=UTF-8',



 data:JSON.stringify({"data":document.activeElement.
 parentElement.parentElement.parentElement.children[0].id})
 })

}

如前所述,该事件触发回调,但是在第一个评论上 触发网址处理程序createComment,它给出500,但是createReply成功触发了回调.

As already stated,the event triggers callback but on first comment facebook triggers url handler createComment which gives 500 but createReply successfully triggers the callback.

推荐答案

comment.create事件在JS SDK中不再存在.

The comment.create event does not exist any more in the JS SDK.

https://developers.facebook.com /docs/reference/javascript/FB.Event.subscribe/v3.2 在单击event

https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/v3.2 does not mention it any more, when you click the down arrow next to event, and https://developers.facebook.com/support/bugs/927463134113943/?comment_id=930637043796552 confirms it is gone: "comment.create is officially killed."

您现在需要使用服务器端Webhooks,如果您希望您的应用通过评论插件获得有关新评论的通知,请参见

You need to use server-side webhooks now, if you want your app to get notified about new comments made via the comments plugin, see https://developers.facebook.com/docs/graph-api/webhooks/reference/application/#plugin_comment

这篇关于触发FB.Event.subscribe("comment.create"),但回复时首次评论成功时返回500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆