jenkins-bot has submitted this change and it was merged. Change subject: Add an HTML comment indicating where the message came from ......................................................................
Add an HTML comment indicating where the message came from Change-Id: Ib174f0d5e38c4d36e7d2c67445e0ded51720778e --- M MassMessage.i18n.php M MassMessageJob.php M SpecialMassMessage.php M tests/MassMessageTest.php 4 files changed, 16 insertions(+), 2 deletions(-) Approvals: MZMcBride: Looks good to me, approved jenkins-bot: Verified diff --git a/MassMessage.i18n.php b/MassMessage.i18n.php index b726584..ea487d1 100644 --- a/MassMessage.i18n.php +++ b/MassMessage.i18n.php @@ -29,6 +29,7 @@ 'massmessage-form-header' => 'Use the form below to send messages to a specified list. All fields are required.', 'massmessage-target' => '[//$1$2?title={{urlencode:$3|WIKI}} $3]', 'massmessage-queued-count' => 'Queued [[Special:MassMessage|mass messages]]', + 'massmessage-hidden-comment' => '<!-- Message sent by User:$1@$2 using the list at $3 -->', 'right-massmessage' => 'Send a message to multiple users at once', 'action-massmessage' => 'send a message to multiple users at once', 'log-name-massmessage' => 'Mass message log', @@ -71,6 +72,10 @@ * $2 is <code>$wgScriptPath</code> (example: "/w/index.php") * $3 the page name (example: "User talk:Example")', 'massmessage-queued-count' => 'Text for row on [[Special:Statistics]].', + 'massmessage-hidden-comment' => 'A hidden HTML comment that is appended after the message. +* $1 is the username of the user who sent the message +* $2 is the database name of the wiki from where the message was sent +* $3 is the url of the input list that was used to send the message', 'right-massmessage' => '{{doc-right|massmessage}} See also: * {{msg-mw|Right-massmessage-global}}', diff --git a/MassMessageJob.php b/MassMessageJob.php index 87c8df7..2d7788f 100644 --- a/MassMessageJob.php +++ b/MassMessageJob.php @@ -100,6 +100,10 @@ global $wgUser, $wgRequest; $user = MassMessage::getMessengerUser(); $wgUser = $user; // Is this safe? We need to do this for EditPage.php + + $text = $this->params['message']; + $text .= "\n" . wfMessage( 'massmessage-hidden-comment' )->params( $this->params['comment'] )->text(); + $api = new ApiMain( new DerivativeRequest( $wgRequest, @@ -108,7 +112,7 @@ 'title' => $this->title->getPrefixedText(), 'section' => 'new', 'summary' => $this->params['subject'], - 'text' => $this->params['message'], + 'text' => $text, 'notminor' => true, 'bot' => true, 'token' => $user->getEditToken() diff --git a/SpecialMassMessage.php b/SpecialMassMessage.php index cb34c1c..1823d97 100644 --- a/SpecialMassMessage.php +++ b/SpecialMassMessage.php @@ -260,8 +260,12 @@ * @return Status */ function submit( $data ) { + global $wgDBname; $spamlist = $this->getSpamlist( $data['spamlist'] ); + // Prep the HTML comment message + $data['comment'] = array( $this->getUser()->getName(), $wgDBname, $spamlist->getFullURL() ); + // Log it. $this->logToWiki( $spamlist, $data['subject'] ); diff --git a/tests/MassMessageTest.php b/tests/MassMessageTest.php index 65f3edc..128d61c 100644 --- a/tests/MassMessageTest.php +++ b/tests/MassMessageTest.php @@ -125,12 +125,13 @@ $wikipage->doDeleteArticleReal( 'reason' ); } $params = array( 'subject' => 'Subject line', 'message' => 'This is a message.', ); + $params['comment'] = array( User::newFromName('Admin'), 'metawiki', 'http://meta.wikimedia.org/wiki/Spamlist' ); $job = new MassMessageJob( $target, $params ); $job->run(); $target = Title::newFromText( 'Project:Testing1234' ); // Clear cache? //$this->assertTrue( $target->exists() ); // Message was created $text = WikiPage::factory( $target )->getContent( Revision::RAW )->getNativeData(); - $this->assertEquals( $text, "== Subject line ==\n\nThis is a message." ); + $this->assertEquals( $text, "== Subject line ==\n\nThis is a message.\n<!-- Message sent by User:Admin@metawiki using the list at http://meta.wikimedia.org/wiki/Spamlist -->" ); } } -- To view, visit https://gerrit.wikimedia.org/r/78479 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib174f0d5e38c4d36e7d2c67445e0ded51720778e Gerrit-PatchSet: 7 Gerrit-Project: mediawiki/extensions/MassMessage Gerrit-Branch: master Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: MZMcBride <w...@mzmcbride.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits