Allowing multiple accepted answers

asked 2017-11-14 21:35:57 -0500

b152349 gravatar image

I've made an adjustment so that a thread can have multiple accepted answers and it works except that when the checkmark is clicked, the checkmark of any previously accepted answer goes from green to gray. I know it works outside of that because when I reload the page, they're both green. So I'm trying to track down the root cause and getting confused but the javascript/event binding (I'm new to js and html fyi)

I get the sense that the event binding for accepting answers leads to the callback_accept function, and that the important stuff is here:

$('#' + answerContainerIdPrefix + postId).addClass('accepted-answer');
object.trigger('askbot.acceptAnswer', [object, data]);

Can anyone give me a hint on what would need to be changed to accomplish what I want? If not, could you walk me through what the three lines above are doing?

But I don't understand whats going on in any line except the first. Anyone able to spell this out for me?

edit retag flag offensive close merge delete