From adaf1ff14759e216d925d8445ab6c870fd763c14 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Thu, 20 Sep 2012 13:46:00 +0300 Subject: [PATCH] Eliminate "Hide current user" checkbox. This was only useful for moderators before all the comments of moderators were automatically marked as read. --- template/app/Settings.js | 1 - template/app/controller/Comments.js | 1 - template/app/view/comments/List.js | 34 +++++++++++++---------------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/template/app/Settings.js b/template/app/Settings.js index 747b20f7..c7e1aff2 100644 --- a/template/app/Settings.js +++ b/template/app/Settings.js @@ -20,7 +20,6 @@ Ext.define("Docs.Settings", { }, comments: { hideRead: false, - hideCurrentUser: false, sortByScore: false }, showPrivateClasses: false, diff --git a/template/app/controller/Comments.js b/template/app/controller/Comments.js index aaf1ee71..11a2371a 100644 --- a/template/app/controller/Comments.js +++ b/template/app/controller/Comments.js @@ -296,7 +296,6 @@ Ext.define('Docs.controller.Comments', { offset: offset || 0, limit: 100, hideRead: settings.hideRead ? 1 : undefined, - hideCurrentUser: settings.hideCurrentUser ? 1 : undefined, sortByScore: settings.sortByScore ? 1 : undefined, username: this.recentCommentsSettings.username }; diff --git a/template/app/view/comments/List.js b/template/app/view/comments/List.js index cb741787..636fdf45 100644 --- a/template/app/view/comments/List.js +++ b/template/app/view/comments/List.js @@ -16,7 +16,6 @@ Ext.define('Docs.view.comments.List', { '

Comments

', '

', '', - '', '

' ].join(" ") } @@ -68,26 +67,23 @@ Ext.define('Docs.view.comments.List', { } }, - // Initializes all checkboxes from settings. - // Bind event handlers to fire changeSetting event when checked/unchecked. + // Initializes the hideRead checkbox from settings. initCheckboxes: function() { var settings = Docs.Settings.get("comments"); - Ext.Array.forEach(['hideRead', 'hideCurrentUser'], function(id) { - var cb = Ext.get(id); - if (cb) { - cb.dom.checked = settings[id]; - cb.on("change", function() { - this.saveSetting(id, cb.dom.checked); - /** - * @event settingChange - * Fired when one of the comments settings checkboxes is checked/unchecked. - * @param {String} name The name of the setting - * @param {Boolean} enabled True if setting is turned on, false when off. - */ - this.fireEvent("settingChange", id, cb.dom.checked); - }, this); - } - }, this); + var cb = Ext.get('hideRead'); + if (cb) { + cb.dom.checked = settings.hideRead; + cb.on("change", function() { + this.saveSetting('hideRead', cb.dom.checked); + /** + * @event settingChange + * Fired when one of the comments settings checkboxes is checked/unchecked. + * @param {String} name The name of the setting + * @param {Boolean} enabled True if setting is turned on, false when off. + */ + this.fireEvent("settingChange", 'hideRead', cb.dom.checked); + }, this); + } // Hide the hideRead checkbox if user is not moderator this.setHideReadVisibility(); -- GitLab