javascript error on disabled voting for question

2.71K viewsIssues
0

Hi!

I have discovered a problem when you disable voting for questions there is a run-time error in AnsPress main.min.js.

There is a part of code which gives an error:

render: function(){
var b=this.$el.find("[ap-vote]").attr("ap-vote");
return this.model.set("vote", a.parseJSON(b), { silent: !0 }),this
}

Using a debugger i’ve figured out that specified element cannot be found which leads to variable ‘b’ become ‘undefined’. After this next line crashes because ‘undefined’ cannot be parsed as JSON.

Apparently, this problem leads to other problems with UI scripts: comments and comment form on answers stop opening.

I tried this on clean AnsPress with my own website template but with no modified AnsPress scripts or templated. AnsPress installed from WP, latest version.

Please, suggest a proper workaround, because I need to disable voting on questions.

commented

Hello,
I cannot replicate your issue with latest version of AnsPress.