File tree Expand file tree Collapse file tree 3 files changed +37
-14
lines changed Expand file tree Collapse file tree 3 files changed +37
-14
lines changed Original file line number Diff line number Diff line change @@ -199,9 +199,13 @@ export default {
199
199
cancelLabel: this .__ (' common.no' ),
200
200
modalName: ' delete' ,
201
201
title: this .deleteAnnouncementLabel ,
202
- message: this .replaceLocaleParams (this .confirmDeleteMessage , {
203
- title: this .localize (announcement .title )
204
- }),
202
+ message: this .replaceLocaleParams (
203
+ this .confirmDeleteMessage ,
204
+ {
205
+ title: this .localize (announcement .title )
206
+ },
207
+ true
208
+ ),
205
209
callback : () => {
206
210
var self = this ;
207
211
$ .ajax ({
Original file line number Diff line number Diff line change 27
27
<list >
28
28
<list-item >
29
29
{{
30
- replaceLocaleParams(this.subjectLabel, {
31
- subject: item.subject
32
- })
30
+ replaceLocaleParams(
31
+ this.subjectLabel,
32
+ {
33
+ subject: item.subject
34
+ },
35
+ true
36
+ )
33
37
}}
34
38
</list-item >
35
39
<list-item v-if =" item.fromRoleId" >
36
40
{{
37
- replaceLocaleParams(this.fromLabel, {
38
- value: getRoleLabel(item.fromRoleId)
39
- })
41
+ replaceLocaleParams(
42
+ this.fromLabel,
43
+ {
44
+ value: getRoleLabel(item.fromRoleId)
45
+ },
46
+ true
47
+ )
40
48
}}
41
49
</list-item >
42
50
<list-item v-if =" item.toRoleId" >
43
51
{{
44
- replaceLocaleParams(this.toLabel, {
45
- value: getRoleLabel(item.toRoleId)
46
- })
52
+ replaceLocaleParams(
53
+ this.toLabel,
54
+ {
55
+ value: getRoleLabel(item.toRoleId)
56
+ },
57
+ true
58
+ )
47
59
}}
48
60
</list-item >
49
61
<list-item
Original file line number Diff line number Diff line change @@ -146,11 +146,18 @@ export default {
146
146
*
147
147
* @param {String } str String to replace params in
148
148
* @param {Object } params Key/value hash of params to replace
149
+ * @param {bool } applyEscaping True iff replaced content should be HTML escaped
149
150
* @return {String }
150
151
*/
151
- replaceLocaleParams ( str , params ) {
152
+ replaceLocaleParams ( str , params , applyEscaping = false ) {
152
153
for ( var param in params ) {
153
- let value = params [ param ] ;
154
+ var value = params [ param ] ;
155
+ if ( applyEscaping ) {
156
+ var text = document . createTextNode ( value ) ;
157
+ var p = document . createElement ( 'p' ) ;
158
+ p . appendChild ( text ) ;
159
+ value = p . innerHTML ;
160
+ }
154
161
// If a locale object is passed, take the value from the current locale
155
162
if ( value === Object ( value ) ) {
156
163
value = this . localize ( value ) ;
You can’t perform that action at this time.
0 commit comments