Wctaiwan has uploaded a new change for review.
https://gerrit.wikimedia.org/r/160787
Change subject: Output the number of recipients on preview
......................................................................
Output the number of recipients on preview
This is basically a rebase of Ia052b3deba0b4d463e9cbaca7338b64865f101ea
Bug: 57472
Change-Id: I342f1e61bbb0254027de173c534ab064e6e89fca
---
M i18n/en.json
M i18n/qqq.json
M includes/SpecialMassMessage.php
3 files changed, 17 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage
refs/changes/87/160787/1
diff --git a/i18n/en.json b/i18n/en.json
index 2a6867e..2e450fc 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -15,6 +15,8 @@
"massmessage-form-preview": "Preview",
"massmessage-form-submit": "Send",
"massmessage-fieldset-preview": "Preview",
+ "massmessage-fieldset-info": "Information",
+ "massmessage-preview-count": "Your message will be sent to
{{PLURAL:$1|$1 page|$1 pages}}.",
"massmessage-submitted": "Your message delivery to {{PLURAL:$1|$1
page|$1 pages}} has been queued.",
"massmessage-just-preview": "This is just a preview. Press
\"{{int:massmessage-form-submit}}\" to send the message.",
"massmessage-spamlist-doesnotexist": "The specified delivery list page
or category does not exist.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 33c0dbf..c1ea39d 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -17,6 +17,8 @@
"massmessage-form-preview": "Label for the preview button on
[[Special:MassMessage]].\n{{Identical|Preview}}",
"massmessage-form-submit": "Label for the submit button on
[[Special:MassMessage]].\n\nUsed in
{{msg-mw|Massmessage-just-preview}}.\n{{Identical|Send}}",
"massmessage-fieldset-preview": "Label for the fieldset box around the
page preview.\n{{Identical|Preview}}",
+ "massmessage-fieldset-info": "Label for the fieldset box around the
delivery information",
+ "massmessage-preview-count": "Text indicating how many pages the
message will be sent to\n* $1 is the number of pages.",
"massmessage-submitted": "Confirmation message the user sees after the
form is submitted successfully and the request is queued in the job
queue.\n\nParameters:\n* $1 - the number of deliveries that have been queued",
"massmessage-just-preview": "Warning to user that what they are seeing
is just a preview, and they should hit the send button to actually submit
it.\n\nRefers to {{msg-mw|Massmessage-form-submit}}.",
"massmessage-spamlist-doesnotexist": "Error message the user sees if
the delivery list page or category they entered does not exist.",
diff --git a/includes/SpecialMassMessage.php b/includes/SpecialMassMessage.php
index f616cef..85a79da 100644
--- a/includes/SpecialMassMessage.php
+++ b/includes/SpecialMassMessage.php
@@ -261,6 +261,19 @@
* @return Status
*/
protected function preview( array $data ) {
+ $this->getOutput()->addWikiMsg( 'massmessage-just-preview' );
+
+ // Output the number of recipients
+ $spamlist = MassMessage::getSpamlist( $data['spamlist'] );
+ $targets = MassMessageTargets::normalizeTargets(
+ MassMessageTargets::getTargets( $spamlist,
$this->getContext() )
+ );
+ $infoFieldset = Xml::fieldset(
+ $this->msg( 'massmessage-fieldset-info' )->text(),
+ $this->msg( 'massmessage-preview-count' )->numParams(
count( $targets ) )->parse()
+ );
+ $this->getOutput()->addHTML( $infoFieldset );
+
// Use a mock target as the context for rendering the preview
$mockTarget = Title::newFromText( 'Project:Example' );
$wikipage = WikiPage::factory( $mockTarget );
@@ -281,7 +294,6 @@
$content = $content->preSaveTransform( $mockTarget,
MassMessage::getMessengerUser(), $parserOptions );
$parserOutput = $content->getParserOutput( $mockTarget, null,
$parserOptions );
$previewHTML = $parserOutput->getText();
- $this->getOutput()->addWikiMsg( 'massmessage-just-preview' );
$fieldsetMessage = $this->msg( 'massmessage-fieldset-preview'
)->text();
$wrapFieldset = Xml::fieldset( $fieldsetMessage, $previewHTML );
$this->getOutput()->addHTML( $wrapFieldset );
--
To view, visit https://gerrit.wikimedia.org/r/160787
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I342f1e61bbb0254027de173c534ab064e6e89fca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Wctaiwan <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits