jenkins-bot has submitted this change and it was merged.
Change subject: Properly escape moderation state in template output
......................................................................
Properly escape moderation state in template output
Change-Id: I594abc07eb8581d1babb84757997ec840afcc1d6
---
M templates/post.html.php
M templates/topic.html.php
2 files changed, 26 insertions(+), 18 deletions(-)
Approvals:
Bsitu: Looks good to me, approved
jenkins-bot: Verified
diff --git a/templates/post.html.php b/templates/post.html.php
index f8880d5..71784b4 100644
--- a/templates/post.html.php
+++ b/templates/post.html.php
@@ -60,12 +60,19 @@
'data-creator-name' => $post->getCreatorName()
) );
?>
- <div id="flow-post-<?php echo $post->getPostId()->getHex()?>"
class="flow-post flow-element-container <?php echo $post->isModerated() ?
'flow-post-moderated' : 'flow-post-unmoderated' ?>" >
- <?php if ( $post->isModerated() ): ?>
- <p class="flow-post-moderated-message
flow-post-moderated-<?php echo $post->getModerationState(); ?>
flow-post-content-<?php echo $post->isAllowed( $user ) ? 'allowed' :
'disallowed'; ?>">
- <?php echo $this->getContent( $post, 'html' );
/* Passing null user will return the 'moderated by Foo' content */ ?>
- </p>
- <?php endif; ?>
+ <div id="flow-post-<?php echo $post->getPostId()->getHex()?>"
class='flow-post flow-element-container <?php echo $post->isModerated() ?
'flow-post-moderated' : 'flow-post-unmoderated' ?>' >
+ <?php
+ if ( $post->isModerated() ):
+ $moderationState = $post->getModerationState();
+ $allowed = $post->isAllowed( $user ) ? 'allowed' :
'disallowed';
+ echo Html::rawElement(
+ 'p',
+ array( 'class' => "flow-post-moderated-message
flow-post-moderated-$moderationState flow-post-content-$allowed", ),
+ // Passing null user will return the 'moderated
by Foo' content
+ $this->getContent( $post, 'html' )
+ );
+ endif;
+ ?>
<div class="flow-post-main">
<div class="flow-post-title">
@@ -119,9 +126,9 @@
<a class="flow-reply-link
mw-ui-button" href="#"><span><?php echo $postView->replyLink(); ?></span></a>
<?php endif ?>
<?php else:
- list( $talkUrl, $talkLink ) =
$postView->moderatedTalkLink();
- echo Html::rawElement(
- 'a',
+ list( $talkUrl, $talkLink ) =
$postView->moderatedTalkLink();
+ echo Html::rawElement(
+ 'a',
array(
'class' =>
'flow-talk-link mw-ui-button',
'href' => $talkUrl,
diff --git a/templates/topic.html.php b/templates/topic.html.php
index 435555b..30d8f69 100644
--- a/templates/topic.html.php
+++ b/templates/topic.html.php
@@ -92,15 +92,16 @@
?>
<div class="flow-topic-title">
- <?php if ( $root->isModerated() ): ?>
- <h2 class='flow-topic-moderated
flow-topic-moderated-<?php echo $root->getModerationState() ?>'>
- <?php echo $this->getContent( $root,
'wikitext' ); /* Passing no user always gets the 'moderated by Foo' message */
?>
- </h2>
- <?php else: ?>
- <h2 class="flow-realtitle">
- <?php echo htmlspecialchars( $title );
?>
- </h2>
- <?php endif ?>
+ <?php if ( $root->isModerated() ):
+ echo Html::rawElement(
+ 'h2',
+ array( 'class' => 'flow-topic-moderated
flow-topic-moderated-' . $root->getModerationState() ),
+ /* Passing no user always gets the
'moderated by Foo' message */
+ $this->getContent( $root, 'wikitext' )
+ );
+ else:
+ echo Html::element( 'h2', array( 'class' =>
'flow-realtitle' ), $title );
+ endif ?>
</div>
<?php if ( $postActionMenu->isAllowedAny( 'hide-topic',
'delete-topic', 'suppress-topic', 'restore-topic' ) ): ?>
--
To view, visit https://gerrit.wikimedia.org/r/99564
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I594abc07eb8581d1babb84757997ec840afcc1d6
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits