@@ -10,7 +10,7 @@ Discourse.ComposerController = Discourse.Controller.extend({
1010 needs : [ 'modal' , 'topic' , 'composerMessages' ] ,
1111
1212 replyAsNewTopicDraft : Em . computed . equal ( 'model.draftKey' , Discourse . Composer . REPLY_AS_NEW_TOPIC_KEY ) ,
13-
13+ checkedMessages : false ,
1414
1515 init : function ( ) {
1616 this . _super ( ) ;
@@ -117,33 +117,18 @@ Discourse.ComposerController = Discourse.Controller.extend({
117117 } ) ;
118118 } ,
119119
120- _considerNewUserEducation : function ( ) {
121-
122- // We don't show education when editing a post.
123- if ( this . get ( 'model.editingPost' ) ) return ;
124-
125- // If creating a topic, use topic_count, otherwise post_count
126- var count = this . get ( 'model.creatingTopic' ) ? Discourse . User . currentProp ( 'topic_count' ) : Discourse . User . currentProp ( 'reply_count' ) ;
127- if ( count >= Discourse . SiteSettings . educate_until_posts ) { return ; }
128-
129- // The user must have typed a reply
130- if ( ! this . get ( 'typedReply' ) ) return ;
131-
132- // If visible update the text
133- var educationKey = this . get ( 'model.creatingTopic' ) ? 'new-topic' : 'new-reply' ,
134- messageController = this . get ( 'controllers.composerMessages' ) ;
135-
136- Discourse . ajax ( "/education/" + educationKey , { dataType : 'html' } ) . then ( function ( result ) {
137- messageController . popup ( {
138- templateName : 'composer/education' ,
139- body : result
140- } ) ;
141- } ) ;
142-
143- } . observes ( 'typedReply' , 'model.creatingTopic' , 'currentUser.reply_count' ) ,
120+ /**
121+ Checks to see if a reply has been typed. This is signaled by a keyUp
122+ event in a view.
144123
124+ @method checkReplyLength
125+ **/
145126 checkReplyLength : function ( ) {
146- this . set ( 'typedReply' , this . present ( 'model.reply' ) ) ;
127+ if ( this . present ( 'model.reply' ) ) {
128+ // Notify the composer messages controller that a reply has been typed. Some
129+ // messages only appear after typing.
130+ this . get ( 'controllers.composerMessages' ) . typedReply ( )
131+ }
147132 } ,
148133
149134 /**
@@ -171,11 +156,11 @@ Discourse.ComposerController = Discourse.Controller.extend({
171156 similarTopics . clear ( ) ;
172157 similarTopics . pushObjects ( newTopics ) ;
173158
174- messageController . popup ( {
159+ messageController . popup ( Discourse . ComposerMessage . create ( {
175160 templateName : 'composer/similar_topics' ,
176161 similarTopics : similarTopics ,
177162 extraClass : 'similar-topics'
178- } ) ;
163+ } ) ) ;
179164 } ) ;
180165
181166 } ,
@@ -203,7 +188,6 @@ Discourse.ComposerController = Discourse.Controller.extend({
203188
204189 var promise = opts . promise || Ember . Deferred . create ( ) ;
205190 opts . promise = promise ;
206- this . set ( 'typedReply' , false ) ;
207191
208192 if ( ! opts . draftKey ) {
209193 alert ( "composer was opened without a draft key" ) ;
@@ -272,8 +256,10 @@ Discourse.ComposerController = Discourse.Controller.extend({
272256
273257 composer = composer || Discourse . Composer . create ( ) ;
274258 composer . open ( opts ) ;
259+
275260 this . set ( 'model' , composer ) ;
276261 composer . set ( 'composeState' , Discourse . Composer . OPEN ) ;
262+ composerMessages . queryFor ( this . get ( 'model' ) ) ;
277263 promise . resolve ( ) ;
278264 return promise ;
279265 } ,
0 commit comments