@@ -167,17 +167,7 @@ Discourse.ComposerView = Discourse.View.extend({
167167
168168 $LAB . script ( assetPath ( 'defer/html-sanitizer-bundle' ) ) ;
169169 Discourse . ComposerView . trigger ( "initWmdEditor" ) ;
170- template = Handlebars . compile ( "<div class='autocomplete'>" +
171- "<ul>" +
172- "{{#each options}}" +
173- "<li>" +
174- "<a href='#'>{{avatar this imageSize=\"tiny\"}} " +
175- "<span class='username'>{{this.username}}</span> " +
176- "<span class='name'>{{this.name}}</span></a>" +
177- "</li>" +
178- "{{/each}}" +
179- "</ul>" +
180- "</div>" ) ;
170+ template = Discourse . UserSelector . templateFunction ( ) ;
181171
182172 transformTemplate = Handlebars . compile ( "{{avatar this imageSize=\"tiny\"}} {{this.username}}" ) ;
183173 $wmdInput . data ( 'init' , true ) ;
@@ -193,38 +183,6 @@ Discourse.ComposerView = Discourse.View.extend({
193183 transformComplete : function ( v ) { return v . username ; }
194184 } ) ;
195185
196- selected = [ ] ;
197- $ ( '#private-message-users' ) . val ( this . get ( 'content.targetUsernames' ) ) . autocomplete ( {
198- template : template ,
199-
200- dataSource : function ( term ) {
201- return Discourse . UserSearch . search ( {
202- term : term ,
203- topicId : _this . get ( 'controller.controllers.topic.content.id' ) ,
204- exclude : selected . concat ( [ Discourse . get ( 'currentUser.username' ) ] )
205- } ) ;
206- } ,
207-
208- onChangeItems : function ( items ) {
209- items = $ . map ( items , function ( i ) {
210- if ( i . username ) {
211- return i . username ;
212- } else {
213- return i ;
214- }
215- } ) ;
216- _this . set ( 'content.targetUsernames' , items . join ( "," ) ) ;
217- selected = items ;
218- } ,
219-
220- transformComplete : transformTemplate ,
221-
222- reverseTransform : function ( i ) {
223- return { username : i } ;
224- }
225-
226- } ) ;
227-
228186 topic = this . get ( 'topic' ) ;
229187 this . editor = editor = Discourse . Markdown . createEditor ( {
230188 lookupAvatar : function ( username ) {
0 commit comments