From 5520eb64065bacad84ae73bf08f1cbdc82b56fbc Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Wed, 7 Nov 2012 13:38:51 +0200 Subject: [PATCH] Avoid errors when handling clicks in list of replies. Only trigger the action when the click happens in current view, not in the subview. --- template/app/view/comments/List.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/template/app/view/comments/List.js b/template/app/view/comments/List.js index 8b869114..58c1b906 100644 --- a/template/app/view/comments/List.js +++ b/template/app/view/comments/List.js @@ -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}); }, -- GitLab