FEATURE: Add title notification to topics

This commit is contained in:
Sam 2015-09-21 08:28:45 +10:00
parent 330a5e80cd
commit da23735062
2 changed files with 15 additions and 0 deletions

View File

@ -78,6 +78,20 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
this.set('notifyCount', count);
},
notifyBackgroundCountIncrement: function() {
if (!this.get('hasFocus')) {
this.set('backgroundNotify', true);
this.set('notifyCount', (this.get('notifyCount') || 0) + 1);
}
},
resetBackgroundNotifyCount: function() {
if (this.get('hasFocus') && this.get('backgroundNotify')) {
this.set('notifyCount', 0);
}
this.set('backgroundNotify', false);
}.observes('hasFocus'),
authenticationComplete: function(options) {
// TODO, how to dispatch this to the controller without the container?
var loginController = Discourse.__container__.lookup('controller:login');

View File

@ -594,6 +594,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
}
case "created": {
postStream.triggerNewPostInStream(data.id);
Discourse.notifyBackgroundCountIncrement();
return;
}
default: {