1
1
import { isEmpty } from "@ember/utils" ;
2
- import Handlebars from "handlebars" ;
3
2
import $ from "jquery" ;
4
3
import TextField from "discourse/components/text-field" ;
5
4
import { renderAvatar } from "discourse/helpers/user-avatar" ;
5
+ import { default as computed , observes } from "discourse/lib/decorators" ;
6
6
import userSearch from "discourse/lib/user-search" ;
7
- import {
8
- default as computed ,
9
- observes ,
10
- } from "discourse-common/utils/decorators" ;
11
- import I18n from "I18n" ;
7
+ import { escapeExpression } from "discourse/lib/utilities" ;
8
+ import { i18n } from "discourse-i18n" ;
12
9
13
10
const template = function ( params ) {
14
11
const options = params . options ;
@@ -17,11 +14,11 @@ const template = function (params) {
17
14
if ( options . users ) {
18
15
html += "<ul>" ;
19
16
options . users . forEach ( ( u ) => {
20
- html += `<li><a href title="${ u . name } ">` ;
17
+ html += `<li><a href title="${ escapeExpression ( u . name ) } ">` ;
21
18
html += renderAvatar ( u , { imageSize : "tiny" } ) ;
22
- html += `<span class='username'>${ u . username } </span>` ;
19
+ html += `<span class='username'>${ escapeExpression ( u . username ) } </span>` ;
23
20
if ( u . name ) {
24
- html += `<span class='name'>${ u . name } </span>` ;
21
+ html += `<span class='name'>${ escapeExpression ( u . name ) } </span>` ;
25
22
}
26
23
html += `</a></li>` ;
27
24
} ) ;
@@ -30,7 +27,7 @@ const template = function (params) {
30
27
31
28
html += "</div>" ;
32
29
33
- return new Handlebars . SafeString ( html ) . string ;
30
+ return html ;
34
31
} ;
35
32
36
33
export default TextField . extend ( {
@@ -42,7 +39,7 @@ export default TextField.extend({
42
39
43
40
@computed ( "placeholderKey" )
44
41
placeholder ( placeholderKey ) {
45
- return placeholderKey ? I18n . t ( placeholderKey ) : "" ;
42
+ return placeholderKey ? i18n ( placeholderKey ) : "" ;
46
43
} ,
47
44
48
45
@observes ( "usernames" )
0 commit comments