Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/75285


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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassMessage 
refs/changes/85/75285/1

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..7b9c8ed 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: newchange
Gerrit-Change-Id: Ifba870a4d6838411602999498c1c10f4a16e14f0
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

Reply via email to