mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
Revert "Merge pull request #2304 from techAPJ/speech-bubble-update"
This reverts commit 6590ebbcbee712d0759cff8c9dd8c1c12a00619b, reversing changes made to 3855ead62ef1caabfeba970c999696cee20036c4.
This commit is contained in:
@ -10,7 +10,6 @@ export default Discourse.Controller.extend({
|
|||||||
topic: null,
|
topic: null,
|
||||||
showExtraInfo: null,
|
showExtraInfo: null,
|
||||||
notifications: null,
|
notifications: null,
|
||||||
loading_notifications: null,
|
|
||||||
|
|
||||||
showStarButton: function() {
|
showStarButton: function() {
|
||||||
return Discourse.User.current() && !this.get('topic.isPrivateMessage');
|
return Discourse.User.current() && !this.get('topic.isPrivateMessage');
|
||||||
@ -26,17 +25,11 @@ export default Discourse.Controller.extend({
|
|||||||
showNotifications: function(headerView) {
|
showNotifications: function(headerView) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (self.get('currentUser.unread_notifications') || self.get('currentUser.unread_private_messages') || !self.get('notifications')) {
|
Discourse.ajax("/notifications").then(function(result) {
|
||||||
self.set("loading_notifications", true);
|
self.set("notifications", result);
|
||||||
Discourse.ajax("/notifications").then(function(result) {
|
self.set("currentUser.unread_notifications", 0);
|
||||||
self.setProperties({
|
headerView.showDropdownBySelector("#user-notifications");
|
||||||
notifications: result,
|
});
|
||||||
loading_notifications: false,
|
|
||||||
'currentUser.unread_notifications': 0
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
headerView.showDropdownBySelector("#user-notifications");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
jumpToTopPost: function () {
|
jumpToTopPost: function () {
|
||||||
@ -48,3 +41,5 @@ export default Discourse.Controller.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
Discourse.NotificationsController = Ember.ArrayController.extend(Discourse.HasCurrentUser, {
|
Discourse.NotificationsController = Ember.ArrayController.extend(Discourse.HasCurrentUser, {
|
||||||
needs: ['header'],
|
|
||||||
itemController: "notification"
|
itemController: "notification"
|
||||||
});
|
});
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
<section class="d-dropdown" id="notifications-dropdown">
|
<section class="d-dropdown" id="notifications-dropdown">
|
||||||
{{#unless controllers.header.loading_notifications}}
|
{{#if content}}
|
||||||
{{#if content}}
|
<ul>
|
||||||
<ul>
|
{{#each}}
|
||||||
{{#each}}
|
<li {{bind-attr class="read"}}>{{unbound boundI18n scope linkBinding="link" usernameBinding="username"}}</li>
|
||||||
<li {{bind-attr class="read"}}>{{unbound boundI18n scope linkBinding="link" usernameBinding="username"}}</li>
|
{{/each}}
|
||||||
{{/each}}
|
<li class="read last">
|
||||||
<li class="read last">
|
<a {{bind-attr href="currentUser.path"}}>{{i18n notifications.more}} …</a>
|
||||||
<a {{bind-attr href="currentUser.path"}}>{{i18n notifications.more}} …</a>
|
</li>
|
||||||
</li>
|
</ul>
|
||||||
</ul>
|
|
||||||
{{else}}
|
|
||||||
<div class="none">{{i18n notifications.none}}</div>
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class='loading'><i class='fa fa-spinner fa-spin'></i></div>
|
<div class="none">{{i18n notifications.none}}</div>
|
||||||
{{/unless}}
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
|
@ -204,13 +204,6 @@
|
|||||||
.none {
|
.none {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
.loading {
|
|
||||||
padding: 10px;
|
|
||||||
display: block;
|
|
||||||
color: lighten($primary_text_color, 50%);
|
|
||||||
font-size: 24px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
|
@ -194,13 +194,6 @@
|
|||||||
.none {
|
.none {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
.loading {
|
|
||||||
padding: 10px;
|
|
||||||
display: block;
|
|
||||||
color: #777;
|
|
||||||
font-size: 24px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
|
@ -23,7 +23,7 @@ test("showNotifications action", function() {
|
|||||||
|
|
||||||
equal(controller.get("notifications"), null, "notifications are null before data has finished loading");
|
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");
|
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() {
|
Ember.run(function() {
|
||||||
|
@ -17,9 +17,7 @@ module("Discourse.NotificationsController", {
|
|||||||
return [scope, options.username, options.link].join(" ").trim();
|
return [scope, options.username, options.link].join(" ").trim();
|
||||||
});
|
});
|
||||||
|
|
||||||
controller = Discourse.NotificationsController.create({
|
controller = Discourse.NotificationsController.create();
|
||||||
container: Discourse.__container__
|
|
||||||
});
|
|
||||||
|
|
||||||
view = Ember.View.create({
|
view = Ember.View.create({
|
||||||
container: Discourse.__container__,
|
container: Discourse.__container__,
|
||||||
|
Reference in New Issue
Block a user