Legoktm has submitted this change and it was merged.

Change subject: Give users an error if they try to send a message with no 
subject line and/or message body.
......................................................................


Give users an error if they try to send a message with no subject line and/or 
message body.

Change-Id: Ifba870a4d6838411602999498c1c10f4a16e14f0
---
M MassMessage.i18n.php
M SpecialMassMessage.php
2 files changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Legoktm: Verified; Looks good to me, approved



diff --git a/MassMessage.i18n.php b/MassMessage.i18n.php
index 45cd0ce..723125d 100644
--- a/MassMessage.i18n.php
+++ b/MassMessage.i18n.php
@@ -24,6 +24,8 @@
        'massmessage-submitted' => 'Your message has been sent!',
        'massmessage-account-blocked' => 'The account used to deliver messages 
has been blocked.',
        'massmessage-spamlist-doesnotexist' => 'The specified page-list page 
does not exist.',
+       'massmessage-empty-subject' => 'The subject line is empty.',
+       'massmessage-empty-message' => 'The message body is empty.',
        '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',
@@ -53,6 +55,8 @@
 spamlist?
 
 This message probably means "The specified page which contains list of pages, 
does not exist".',
+       '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.',
        'right-massmessage' => '{{doc-right|massmessage}}
 See also:
 * {{msg-mw|Right-massmessage-global}}',
diff --git a/SpecialMassMessage.php b/SpecialMassMessage.php
index 19fbc2e..36ca834 100644
--- a/SpecialMassMessage.php
+++ b/SpecialMassMessage.php
@@ -166,6 +166,14 @@
                        $status->fatal( 'massmessage-account-blocked' );
                }
 
+               if ( trim( $data['subject'] ) === '' ) {
+                       $status->fatal( 'massmessage-empty-subject' );
+               }
+
+               if ( trim( $data['message'] ) === '' ) {
+                       $status->fatal( 'massmessage-empty-message' );
+               }
+
                // If we have any errors, abort.
                if ( !$status->isOK() ) {
                        return $status;

-- 
To view, visit https://gerrit.wikimedia.org/r/75285
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifba870a4d6838411602999498c1c10f4a16e14f0
Gerrit-PatchSet: 2
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>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to