Commit 5520eb64 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Avoid errors when handling clicks in list of replies.

Only trigger the action when the click happens in current view,
not in the subview.
parent ecab9f72
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -94,7 +94,15 @@ Ext.define('Docs.view.comments.List', {

    delegateClick: function(selector, callback, scope) {
        this.getEl().on("click", function(event, el) {
            callback.call(scope, el, this.getRecord(this.findItemByChild(el)));
            var comment = this.getRecord(this.findItemByChild(el));
            // In case of replies to comments, this handler will also
            // pick up events really targeted for the sublist, but we
            // don't want to act on these.  But in such case the view
            // is unable to find the corresponding record - so we stop
            // here.
            if (comment) {
                callback.call(scope, el, comment);
            }
        }, this, {preventDefault: true, delegate: selector});
    },