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