jenkins-bot has submitted this change and it was merged.

Change subject: Don't let admin create a new campaign if one is already in 
progress
......................................................................


Don't let admin create a new campaign if one is already in progress

Bug:T90604
Change-Id: I7965217f1ed0698a70b45df00495e72870262f19
---
M data/i18n/en.json
M data/i18n/qqq.json
M src/Controllers/Admin/Campaign.php
3 files changed, 7 insertions(+), 1 deletion(-)

Approvals:
  BryanDavis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/data/i18n/en.json b/data/i18n/en.json
index 33765eb..42ec18a 100644
--- a/data/i18n/en.json
+++ b/data/i18n/en.json
@@ -107,6 +107,7 @@
        "admin-campaign-update-fail": "Error. Check logs.",
        "admin-campaign-end-button": "End Campaign",
        "admin-campaign-end-success": "Campaign succesfully ended",
+       "admin-new-campaign-in-progress": "Cannot create a new campaign if one 
is already in progress. Please end the current campaign before starting a new 
one.",
 
        "page-of-pages": "Page $1 of $2",
        "no-results": "No results found",
diff --git a/data/i18n/qqq.json b/data/i18n/qqq.json
index 35e943a..eb91767 100644
--- a/data/i18n/qqq.json
+++ b/data/i18n/qqq.json
@@ -43,6 +43,7 @@
        "admin-campaigns-id": "Table column header, ID of 
campaign.\n{{Identical|ID}}",
        "admin-campaign-end-button": "Button label",
        "admin-campaign-end-success": "Message string for succesful campaign 
end",
+       "admin-new-campaign-in-progress": "Message shown to user when a new 
campaign creation fails because an exsting one is in progress",
 
        "change-password": "Navigation menu item, links to password change 
page.\n{{Identical|Change password}}",
        "credits": "Credits page heading",
diff --git a/src/Controllers/Admin/Campaign.php 
b/src/Controllers/Admin/Campaign.php
index bbae914..cb3139d 100644
--- a/src/Controllers/Admin/Campaign.php
+++ b/src/Controllers/Admin/Campaign.php
@@ -66,7 +66,11 @@
                                'end_date' => $this->form->get( 'end_date' ),
                        );
 
-                       if ( $id == 'new' ) {
+                       if ( $id == 'new' && $this->dao->activeCampaign() ) {
+                               $this->flash( 'error',
+                                       $this->i18nContext->message( 
'admin-new-campaign-in-progress' )
+                               );
+                       } elseif ( $id == 'new' ) {
                                // This is a temporary fix to make the *just 
started* campaign active
                                // and bypass the actual start and end date
                                // to be fixed in a subsequent patch when 
actual logic for using

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7965217f1ed0698a70b45df00495e72870262f19
Gerrit-PatchSet: 3
Gerrit-Project: wikimedia/iegreview
Gerrit-Branch: master
Gerrit-Owner: Niharika29 <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to