jenkins-bot has submitted this change and it was merged.
Change subject: Hygiene: Output content/format pair for moderateReason
......................................................................
Hygiene: Output content/format pair for moderateReason
When outputting api keys that contain fully user generated content we have
been outputting a content/format pair so api consumers know how to escape
the content. Additionally this is required for a follow patch which uses
moderateReason within a preview context, previews always use the
content/format pair when injecting the new content into the templates.
Change-Id: Ia5fda59f29415e954380f1282ebfcf4cb71a6be0
---
M handlebars/compiled/flow_block_topic.handlebars.php
M handlebars/compiled/flow_block_topic_history.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
M handlebars/compiled/flow_block_topiclist.handlebars.php
M handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
M handlebars/compiled/flow_post.handlebars.php
M handlebars/flow_topic_titlebar_content.handlebars
M includes/Formatter/RevisionFormatter.php
9 files changed, 22 insertions(+), 17 deletions(-)
Approvals:
Matthias Mullie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/handlebars/compiled/flow_block_topic.handlebars.php
b/handlebars/compiled/flow_block_topic.handlebars.php
index da98d64..1de070e 100644
--- a/handlebars/compiled/flow_block_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic.handlebars.php
@@ -72,7 +72,7 @@
'.LCRun3::ch($cx, 'l10n',
Array(Array('post_moderation_state',((is_array($in) &&
isset($in['moderateState'])) ? $in['moderateState'] : null),((is_array($in) &&
isset($in['replyToId'])) ? $in['replyToId'] :
null),((is_array($in['moderator']) && isset($in['moderator']['name'])) ?
$in['moderator']['name'] : null)),Array()), 'encq').'</div>
<div class="flow-moderated-topic-reason">
'.LCRun3::ch($cx, 'l10n',
Array(Array('flow-topic-moderated-reason-prefix'),Array()), 'encq').'
- '.htmlentities(((is_array($in) && isset($in['moderateReason']))
? $in['moderateReason'] : null), ENT_QUOTES, 'UTF-8').'
+ '.LCRun3::ch($cx, 'escapeContent',
Array(Array(((is_array($in['moderateReason']) &&
isset($in['moderateReason']['format'])) ? $in['moderateReason']['format'] :
null),((is_array($in['moderateReason']) &&
isset($in['moderateReason']['content'])) ? $in['moderateReason']['content'] :
null)),Array()), 'encq').'
</div>
' : '').'
<span class="flow-reply-count"><span class="wikiglyph
wikiglyph-speech-bubble"></span><span
class="flow-reply-count-number">'.htmlentities(((is_array($in) &&
isset($in['reply_count'])) ? $in['reply_count'] : null), ENT_QUOTES,
'UTF-8').'</span></span>
diff --git a/handlebars/compiled/flow_block_topic_history.handlebars.php
b/handlebars/compiled/flow_block_topic_history.handlebars.php
index a5df98a..c7c390b 100644
--- a/handlebars/compiled/flow_block_topic_history.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_history.handlebars.php
@@ -25,14 +25,14 @@
<ul>
'.LCRun3::sec($cx, ((is_array($in) &&
isset($in['revisions'])) ? $in['revisions'] : null), $in, true, function($cx,
$in) {return '
<li>
- ('.((LCRun3::ifvar($cx,
((is_array($in['links']) && isset($in['links']['diff-cur'])) ?
$in['links']['diff-cur'] : null))) ? '<a
href="'.htmlentities(((is_array($in['links']['diff-cur']) &&
isset($in['links']['diff-cur']['url'])) ? $in['links']['diff-cur']['url'] :
null), ENT_QUOTES, 'UTF-8').'"
title="'.htmlentities(((is_array($in['links']['diff-cur']) &&
isset($in['links']['diff-cur']['title'])) ? $in['links']['diff-cur']['title'] :
null), ENT_QUOTES,
'UTF-8').'">'.htmlentities(((is_array($in['links']['diff-cur']) &&
isset($in['links']['diff-cur']['title'])) ? $in['links']['diff-cur']['title'] :
null), ENT_QUOTES, 'UTF-8').'</a>' : ''.LCRun3::ch($cx, 'l10n',
Array(Array('cur'),Array()), 'encq').'
- ').'
- '.LCRun3::ch($cx, 'l10n',
Array(Array('pipe-separator'),Array()), 'encq').'
- '.((LCRun3::ifvar($cx,
((is_array($in['links']) && isset($in['links']['diff-prev'])) ?
$in['links']['diff-prev'] : null))) ? '
- <a
href="'.htmlentities(((is_array($in['links']['diff-prev']) &&
isset($in['links']['diff-prev']['url'])) ? $in['links']['diff-prev']['url'] :
null), ENT_QUOTES, 'UTF-8').'"
title="'.htmlentities(((is_array($in['links']['diff-prev']) &&
isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title']
: null), ENT_QUOTES,
'UTF-8').'">'.htmlentities(((is_array($in['links']['diff-prev']) &&
isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title']
: null), ENT_QUOTES, 'UTF-8').'</a>' : ''.LCRun3::ch($cx, 'l10n',
Array(Array('last'),Array()), 'encq').'
- ').''.((LCRun3::ifvar($cx,
((is_array($in['links']) && isset($in['links']['topic'])) ?
$in['links']['topic'] : null))) ? '
- '.LCRun3::ch($cx,
'l10n', Array(Array('pipe-separator'),Array()), 'encq').'
- <a
href="'.htmlentities(((is_array($in['links']['topic']) &&
isset($in['links']['topic']['url'])) ? $in['links']['topic']['url'] : null),
ENT_QUOTES, 'UTF-8').'" title="'.htmlentities(((is_array($in['links']['topic'])
&& isset($in['links']['topic']['title'])) ? $in['links']['topic']['title'] :
null), ENT_QUOTES, 'UTF-8').'">'.htmlentities(((is_array($in['links']['topic'])
&& isset($in['links']['topic']['title'])) ? $in['links']['topic']['title'] :
null), ENT_QUOTES, 'UTF-8').'</a>' : '').')
+ <span
class="flow-pipelist">'.htmlentities(((is_array($in) && isset($in['noop'])) ?
$in['noop'] : null), ENT_QUOTES, 'UTF-8').'<span>'.((LCRun3::ifvar($cx,
((is_array($in['links']) && isset($in['links']['diff-cur'])) ?
$in['links']['diff-cur'] : null))) ? '<a
href="'.htmlentities(((is_array($in['links']['diff-cur']) &&
isset($in['links']['diff-cur']['url'])) ? $in['links']['diff-cur']['url'] :
null), ENT_QUOTES, 'UTF-8').'"
title="'.htmlentities(((is_array($in['links']['diff-cur']) &&
isset($in['links']['diff-cur']['title'])) ? $in['links']['diff-cur']['title'] :
null), ENT_QUOTES,
'UTF-8').'">'.htmlentities(((is_array($in['links']['diff-cur']) &&
isset($in['links']['diff-cur']['title'])) ? $in['links']['diff-cur']['title'] :
null), ENT_QUOTES, 'UTF-8').'</a>' : ''.LCRun3::ch($cx, 'l10n',
Array(Array('cur'),Array()), 'encq').'
+ ').'
+ </span>
+ <span>
+ '.((LCRun3::ifvar($cx,
((is_array($in['links']) && isset($in['links']['diff-prev'])) ?
$in['links']['diff-prev'] : null))) ? '
+ <a
href="'.htmlentities(((is_array($in['links']['diff-prev']) &&
isset($in['links']['diff-prev']['url'])) ? $in['links']['diff-prev']['url'] :
null), ENT_QUOTES, 'UTF-8').'"
title="'.htmlentities(((is_array($in['links']['diff-prev']) &&
isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title']
: null), ENT_QUOTES,
'UTF-8').'">'.htmlentities(((is_array($in['links']['diff-prev']) &&
isset($in['links']['diff-prev']['title'])) ? $in['links']['diff-prev']['title']
: null), ENT_QUOTES, 'UTF-8').'</a>' : ''.LCRun3::ch($cx, 'l10n',
Array(Array('last'),Array()), 'encq').'
+
').'</span>'.((LCRun3::ifvar($cx, ((is_array($in['links']) &&
isset($in['links']['topic'])) ? $in['links']['topic'] : null))) ? '
+ <span><a
href="'.htmlentities(((is_array($in['links']['topic']) &&
isset($in['links']['topic']['url'])) ? $in['links']['topic']['url'] : null),
ENT_QUOTES, 'UTF-8').'" title="'.htmlentities(((is_array($in['links']['topic'])
&& isset($in['links']['topic']['title'])) ? $in['links']['topic']['title'] :
null), ENT_QUOTES, 'UTF-8').'">'.htmlentities(((is_array($in['links']['topic'])
&& isset($in['links']['topic']['title'])) ? $in['links']['topic']['title'] :
null), ENT_QUOTES, 'UTF-8').'</a></span>' : '').'</span>
'.LCRun3::ch($cx, 'historyTimestamp',
Array(Array($in),Array()), 'encq').'
diff --git a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
index 45e7344..fcc1646 100644
--- a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
@@ -625,4 +625,4 @@
</div>
';
}
-?>
+?>
\ No newline at end of file
diff --git a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
index b3b0736..928d23d 100644
--- a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
@@ -625,4 +625,4 @@
</div>
';
}
-?>
+?>
\ No newline at end of file
diff --git a/handlebars/compiled/flow_block_topiclist.handlebars.php
b/handlebars/compiled/flow_block_topiclist.handlebars.php
index 18ce80e..c6119e0 100644
--- a/handlebars/compiled/flow_block_topiclist.handlebars.php
+++ b/handlebars/compiled/flow_block_topiclist.handlebars.php
@@ -203,7 +203,7 @@
'.LCRun3::ch($cx, 'l10n',
Array(Array('post_moderation_state',((is_array($in) &&
isset($in['moderateState'])) ? $in['moderateState'] : null),((is_array($in) &&
isset($in['replyToId'])) ? $in['replyToId'] :
null),((is_array($in['moderator']) && isset($in['moderator']['name'])) ?
$in['moderator']['name'] : null)),Array()), 'encq').'</div>
<div class="flow-moderated-topic-reason">
'.LCRun3::ch($cx, 'l10n',
Array(Array('flow-topic-moderated-reason-prefix'),Array()), 'encq').'
- '.htmlentities(((is_array($in) && isset($in['moderateReason']))
? $in['moderateReason'] : null), ENT_QUOTES, 'UTF-8').'
+ '.LCRun3::ch($cx, 'escapeContent',
Array(Array(((is_array($in['moderateReason']) &&
isset($in['moderateReason']['format'])) ? $in['moderateReason']['format'] :
null),((is_array($in['moderateReason']) &&
isset($in['moderateReason']['content'])) ? $in['moderateReason']['content'] :
null)),Array()), 'encq').'
</div>
' : '').'
<span class="flow-reply-count"><span class="wikiglyph
wikiglyph-speech-bubble"></span><span
class="flow-reply-count-number">'.htmlentities(((is_array($in) &&
isset($in['reply_count'])) ? $in['reply_count'] : null), ENT_QUOTES,
'UTF-8').'</span></span>
@@ -618,4 +618,4 @@
</div>
';
}
-?>
+?>
\ No newline at end of file
diff --git a/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
b/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
index 9f77f6f..1333694 100644
--- a/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
+++ b/handlebars/compiled/flow_block_topiclist_newtopic.handlebars.php
@@ -65,9 +65,11 @@
<textarea name="topiclist_content"
data-flow-preview-template="flow_topic"
class="mw-ui-input flow-form-collapsible
mw-ui-input-large"
+ style="display:none;"
placeholder="'.LCRun3::ch($cx, 'l10n',
Array(Array('flow-newtopic-content-placeholder',((is_array($cx['scopes'][0]) &&
isset($cx['scopes'][0]['title'])) ? $cx['scopes'][0]['title'] :
null)),Array()), 'encq').'" data-role="content" required></textarea>
- <div class="flow-form-actions flow-form-collapsible">
+ <div class="flow-form-actions flow-form-collapsible"
+ style="display:none;">
<button data-role="submit"
data-flow-api-handler="newTopic"
data-flow-interactive-handler="apiRequest"
class="mw-ui-button mw-ui-constructive
mw-ui-flush-right">'.LCRun3::ch($cx, 'l10n',
Array(Array('flow-newtopic-save'),Array()), 'encq').'</button>
diff --git a/handlebars/compiled/flow_post.handlebars.php
b/handlebars/compiled/flow_post.handlebars.php
index c6618f8..d1c8de4 100644
--- a/handlebars/compiled/flow_post.handlebars.php
+++ b/handlebars/compiled/flow_post.handlebars.php
@@ -582,4 +582,4 @@
';}).'
';
}
-?>
+?>
\ No newline at end of file
diff --git a/handlebars/flow_topic_titlebar_content.handlebars
b/handlebars/flow_topic_titlebar_content.handlebars
index 13b9211..8d61750 100644
--- a/handlebars/flow_topic_titlebar_content.handlebars
+++ b/handlebars/flow_topic_titlebar_content.handlebars
@@ -25,7 +25,7 @@
</div>
<div class="flow-moderated-topic-reason">
{{l10n "flow-topic-moderated-reason-prefix"}}
- {{moderateReason}}
+ {{escapeContent moderateReason.format moderateReason.content}}
</div>
{{/if}}
<span class="flow-reply-count"><span class="wikiglyph
wikiglyph-speech-bubble"></span><span
class="flow-reply-count-number">{{reply_count}}</span></span>
diff --git a/includes/Formatter/RevisionFormatter.php
b/includes/Formatter/RevisionFormatter.php
index 8399026..454da42 100644
--- a/includes/Formatter/RevisionFormatter.php
+++ b/includes/Formatter/RevisionFormatter.php
@@ -192,7 +192,10 @@
);
// @todo why moderate instead of moderated or something
else?
$res['moderateState'] =
$moderatedRevision->getModerationState();
- $res['moderateReason'] =
$moderatedRevision->getModeratedReason();
+ $res['moderateReason'] = array(
+ 'content' =>
$moderatedRevision->getModeratedReason(),
+ 'format' => 'plaintext',
+ );
}
if ( $isContentAllowed ) {
--
To view, visit https://gerrit.wikimedia.org/r/164662
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5fda59f29415e954380f1282ebfcf4cb71a6be0
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits