Skip to content

Commit

Permalink
FIX: reply after like does nothing
Browse files Browse the repository at this point in the history
(attempt to fix)
  • Loading branch information
SamSaffron committed Sep 25, 2014
1 parent e14e8f6 commit 52a9409
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions app/assets/javascripts/discourse/views/post-menu.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,26 @@ export default Discourse.View.extend({
buffer.push("</nav>");
},

// Delegate click actions
click: function(e) {
var $target = $(e.target),
action = $target.data('action') || $target.parent().data('action');
didInsertElement: function(){
// @Robin, why is this being called twice on initial render?
// this is a workaround to try to fix https://meta.discourse.org/t/click-on-reply-sometimes-without-effect/19860
var self = this;
var $self = this.$();

if (!action) return;
var handler = this["click" + action.capitalize()];
if (!handler) return;
$self.off('click.post').on('click.post', function(e){
var $target = $(e.target),
action = $target.data('action') || $target.parent().data('action');

handler.call(this, this.get('post'));
if (!action) return;
var handler = self["click" + action.capitalize()];
if (!handler) return;

handler.call(self, self.get('post'));
});
},

willDestroyElement: function(){
this.$().off('click.post');
},

// Replies Button
Expand Down

0 comments on commit 52a9409

Please sign in to comment.