Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/78479
Change subject: Add a HTML comment indicating where the message came from
......................................................................
Add a HTML comment indicating where the message came from
Change-Id: Ib174f0d5e38c4d36e7d2c67445e0ded51720778e
---
M MassMessage.i18n.php
M MassMessageJob.php
M SpecialMassMessage.php
3 files changed, 16 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage
refs/changes/79/78479/1
diff --git a/MassMessage.i18n.php b/MassMessage.i18n.php
index cb9c69b..622d8ed 100644
--- a/MassMessage.i18n.php
+++ b/MassMessage.i18n.php
@@ -30,6 +30,7 @@
'massmessage-empty-subject' => 'The subject line is empty.',
'massmessage-empty-message' => 'The message body is empty.',
'massmessage-form-header' => 'Use the form below to send messages to a
specified list. All fields are required.',
+ 'massmessage-hidden-comment' => 'Message sent by User:$1@$2 using the
$3 list.',
'right-massmessage' => 'Send a message to multiple users at once',
'action-massmessage' => 'send a message to multiple users at once',
'right-massmessage-global' => 'Send a message to multiple users on
different wikis at once',
@@ -66,6 +67,11 @@
'massmessage-empty-subject' => 'Error message the user sees if the
"subject" field is empty.',
'massmessage-empty-message' => 'Error message the user sees if the
"message" field is empty.',
'massmessage-form-header' => 'Introduction text at the top of the
form.',
+ '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 name 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 ea4fc62..b426f67 100644
--- a/MassMessageJob.php
+++ b/MassMessageJob.php
@@ -102,6 +102,11 @@
global $wgUser, $wgRequest;
$user = MassMessage::getMessengerUser();
$wgUser = $user; // Is this safe? We need to do this for
EditPage.php
+
+ // Add our HTML comment
+ $text = $this->params['message'];
+ $text .= '\n<!-- ' . wfMessage( 'massmessage-hidden-comment'
)->params( $this->params['comment'] )->text() . '-->';
+
$api = new ApiMain(
new DerivativeRequest(
$wgRequest,
@@ -110,7 +115,7 @@
'title' => $this->title->getFullText(),
'section' => 'new',
'summary' => $this->params['subject'],
- 'text' => $this->params['message'],
+ 'text' => $text,
'notminor' => true,
'bot' => true,
'token' => $user->editToken()
diff --git a/SpecialMassMessage.php b/SpecialMassMessage.php
index c0c21ce..df11bec 100644
--- a/SpecialMassMessage.php
+++ b/SpecialMassMessage.php
@@ -299,9 +299,13 @@
* @return Status
*/
function submit( $data ) {
+ global $wgDBname;
$spamlist = $this->getLocalSpamlist( $data['spamlist'] );
+ // Prep the HTML comment message
+ $data['comment'] = array( $this->getUser()->getName(),
$wgDBname, $spamlist->getFullText() );
+
// Log it.
$this->logToWiki( $spamlist, $data['subject'] );
--
To view, visit https://gerrit.wikimedia.org/r/78479
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib174f0d5e38c4d36e7d2c67445e0ded51720778e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits