From 842dd91958b1cf336dbac2754f18cb741e6b37c0 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 9 May 2014 12:01:36 -0400 Subject: [PATCH] Revert "Merge pull request #2304 from techAPJ/speech-bubble-update" This reverts commit 6590ebbcbee712d0759cff8c9dd8c1c12a00619b, reversing changes made to 3855ead62ef1caabfeba970c999696cee20036c4. --- .../discourse/controllers/header.js.es6 | 19 +++++--------- .../controllers/notifications_controller.js | 1 - .../templates/notifications.js.handlebars | 26 ++++++++----------- app/assets/stylesheets/desktop/header.scss | 7 ----- app/assets/stylesheets/mobile/header.scss | 7 ----- .../controllers/header_controller_test.js | 2 +- .../notifications_controller_test.js | 4 +-- 7 files changed, 20 insertions(+), 46 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/header.js.es6 b/app/assets/javascripts/discourse/controllers/header.js.es6 index dcfe1ee6d62..4bd9934acf5 100644 --- a/app/assets/javascripts/discourse/controllers/header.js.es6 +++ b/app/assets/javascripts/discourse/controllers/header.js.es6 @@ -10,7 +10,6 @@ export default Discourse.Controller.extend({ topic: null, showExtraInfo: null, notifications: null, - loading_notifications: null, showStarButton: function() { return Discourse.User.current() && !this.get('topic.isPrivateMessage'); @@ -26,17 +25,11 @@ export default Discourse.Controller.extend({ showNotifications: function(headerView) { var self = this; - if (self.get('currentUser.unread_notifications') || self.get('currentUser.unread_private_messages') || !self.get('notifications')) { - self.set("loading_notifications", true); - Discourse.ajax("/notifications").then(function(result) { - self.setProperties({ - notifications: result, - loading_notifications: false, - 'currentUser.unread_notifications': 0 - }); - }); - } - headerView.showDropdownBySelector("#user-notifications"); + Discourse.ajax("/notifications").then(function(result) { + self.set("notifications", result); + self.set("currentUser.unread_notifications", 0); + headerView.showDropdownBySelector("#user-notifications"); + }); }, jumpToTopPost: function () { @@ -48,3 +41,5 @@ export default Discourse.Controller.extend({ } }); + + diff --git a/app/assets/javascripts/discourse/controllers/notifications_controller.js b/app/assets/javascripts/discourse/controllers/notifications_controller.js index 3f6738a15dd..1268515f449 100644 --- a/app/assets/javascripts/discourse/controllers/notifications_controller.js +++ b/app/assets/javascripts/discourse/controllers/notifications_controller.js @@ -1,4 +1,3 @@ Discourse.NotificationsController = Ember.ArrayController.extend(Discourse.HasCurrentUser, { - needs: ['header'], itemController: "notification" }); diff --git a/app/assets/javascripts/discourse/templates/notifications.js.handlebars b/app/assets/javascripts/discourse/templates/notifications.js.handlebars index f86ddcb4dcd..7b06cd115ac 100644 --- a/app/assets/javascripts/discourse/templates/notifications.js.handlebars +++ b/app/assets/javascripts/discourse/templates/notifications.js.handlebars @@ -1,18 +1,14 @@
- {{#unless controllers.header.loading_notifications}} - {{#if content}} - - {{else}} -
{{i18n notifications.none}}
- {{/if}} + {{#if content}} + {{else}} -
- {{/unless}} +
{{i18n notifications.none}}
+ {{/if}}
diff --git a/app/assets/stylesheets/desktop/header.scss b/app/assets/stylesheets/desktop/header.scss index 7c051b4e847..9947dab4f29 100644 --- a/app/assets/stylesheets/desktop/header.scss +++ b/app/assets/stylesheets/desktop/header.scss @@ -204,13 +204,6 @@ .none { padding: 5px; } - .loading { - padding: 10px; - display: block; - color: lighten($primary_text_color, 50%); - font-size: 24px; - text-align: center; - } } // Search diff --git a/app/assets/stylesheets/mobile/header.scss b/app/assets/stylesheets/mobile/header.scss index 762ebe61b92..c102af15e58 100644 --- a/app/assets/stylesheets/mobile/header.scss +++ b/app/assets/stylesheets/mobile/header.scss @@ -194,13 +194,6 @@ .none { padding: 5px; } - .loading { - padding: 10px; - display: block; - color: #777; - font-size: 24px; - text-align: center; - } } // Search diff --git a/test/javascripts/controllers/header_controller_test.js b/test/javascripts/controllers/header_controller_test.js index be5b8ca2b1b..73db59ffe73 100644 --- a/test/javascripts/controllers/header_controller_test.js +++ b/test/javascripts/controllers/header_controller_test.js @@ -23,7 +23,7 @@ test("showNotifications action", function() { equal(controller.get("notifications"), null, "notifications are null before data has finished loading"); equal(Discourse.User.current().get("unread_notifications"), 1, "current user's unread notifications count is not zeroed before data has finished loading"); - ok(viewSpy.showDropdownBySelector.calledWith("#user-notifications"), "dropdown with loading glyph is shown before data has finished loading"); + ok(viewSpy.showDropdownBySelector.notCalled, "dropdown with notifications is not shown before data has finished loading"); Ember.run(function() { diff --git a/test/javascripts/controllers/notifications_controller_test.js b/test/javascripts/controllers/notifications_controller_test.js index 35aae226805..045939b768d 100644 --- a/test/javascripts/controllers/notifications_controller_test.js +++ b/test/javascripts/controllers/notifications_controller_test.js @@ -17,9 +17,7 @@ module("Discourse.NotificationsController", { return [scope, options.username, options.link].join(" ").trim(); }); - controller = Discourse.NotificationsController.create({ - container: Discourse.__container__ - }); + controller = Discourse.NotificationsController.create(); view = Ember.View.create({ container: Discourse.__container__,