FIX: popups stopped appearing
This commit is contained in:
parent
df3b1f6968
commit
a7a3b199ef
|
@ -5,10 +5,9 @@ export default Ember.ArrayController.extend({
|
|||
// Whether we've checked our messages
|
||||
checkedMessages: false,
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
_init: function() {
|
||||
this.reset();
|
||||
},
|
||||
}.on("init"),
|
||||
|
||||
actions: {
|
||||
closeMessage(message) {
|
||||
|
@ -29,14 +28,11 @@ export default Ember.ArrayController.extend({
|
|||
this.pushObject(message);
|
||||
messagesByTemplate[templateName] = message;
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
Resets all active messages. For example if composing a new post.
|
||||
|
||||
@method reset
|
||||
**/
|
||||
// Resets all active messages.
|
||||
// For example if composing a new post.
|
||||
reset() {
|
||||
this.clear();
|
||||
this.setProperties({
|
||||
|
@ -46,42 +42,22 @@ export default Ember.ArrayController.extend({
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
Called after the user has typed a reply. Some messages only get shown after being
|
||||
typed.
|
||||
|
||||
@method typedReply
|
||||
**/
|
||||
// Called after the user has typed a reply.
|
||||
// Some messages only get shown after being typed.
|
||||
typedReply() {
|
||||
var self = this;
|
||||
this.get('queuedForTyping').forEach(function(msg){
|
||||
if(self.popup){
|
||||
self.popup(msg);
|
||||
}
|
||||
});
|
||||
this.get('queuedForTyping').forEach(msg => this.send("popup", msg));
|
||||
},
|
||||
|
||||
/**
|
||||
Figure out if there are any messages that should be displayed above the composer.
|
||||
|
||||
@method queryFor
|
||||
@params {Discourse.Composer} composer The composer model
|
||||
**/
|
||||
// Figure out if there are any messages that should be displayed above the composer.
|
||||
queryFor(composer) {
|
||||
if (this.get('checkedMessages')) { return; }
|
||||
|
||||
const self = this;
|
||||
let queuedForTyping = self.get('queuedForTyping');
|
||||
var queuedForTyping = self.get('queuedForTyping');
|
||||
|
||||
Discourse.ComposerMessage.find(composer).then(function (messages) {
|
||||
Discourse.ComposerMessage.find(composer).then(messages => {
|
||||
self.set('checkedMessages', true);
|
||||
messages.forEach(function (msg) {
|
||||
if (msg.wait_for_typing) {
|
||||
queuedForTyping.addObject(msg);
|
||||
} else {
|
||||
self.popup(msg);
|
||||
}
|
||||
});
|
||||
messages.forEach(msg => msg.wait_for_typing ? queuedForTyping.addObject(msg) : self.send("popup", msg));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -267,12 +267,8 @@ export default DiscourseController.extend({
|
|||
return promise;
|
||||
},
|
||||
|
||||
/**
|
||||
Checks to see if a reply has been typed. This is signaled by a keyUp
|
||||
event in a view.
|
||||
|
||||
@method checkReplyLength
|
||||
**/
|
||||
// Checks to see if a reply has been typed.
|
||||
// This is signaled by a keyUp event in a view.
|
||||
checkReplyLength() {
|
||||
if (this.present('model.reply')) {
|
||||
// Notify the composer messages controller that a reply has been typed. Some
|
||||
|
@ -281,12 +277,8 @@ export default DiscourseController.extend({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
Fired after a user stops typing. Considers whether to check for similar
|
||||
topics based on the current composer state.
|
||||
|
||||
@method findSimilarTopics
|
||||
**/
|
||||
// Fired after a user stops typing.
|
||||
// Considers whether to check for similar topics based on the current composer state.
|
||||
findSimilarTopics() {
|
||||
// We don't care about similar topics unless creating a topic
|
||||
if (!this.get('model.creatingTopic')) { return; }
|
||||
|
|
Loading…
Reference in New Issue