r100436 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100435‎ | r100436 | r100437 >
Date:18:47, 21 October 2011
Author:reedy
Status:resolved
Tags:
Comment:
Followup r100432

Disable challenge deletion
Modified paths:
  • /trunk/extensions/Contest/resources/contest.special.editcontest.js (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestWelcome.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialEditContest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php
@@ -142,11 +142,13 @@
143143 $challenges[] = $data;
144144 }
145145
 146+ global $wgContestDeletionEnabled;
146147 $this->getOutput()->addScript(
147148 Skin::makeVariablesScript(
148149 array(
149150 'ContestChallenges' => $challenges,
150 - 'ContestConfig' => array()
 151+ 'ContestConfig' => array(),
 152+ 'ContestDeletionEnabled' => $wgContestDeletionEnabled,
151153 )
152154 )
153155 );
@@ -188,7 +190,7 @@
189191 */
190192 protected function showRules( Contest $contest ) {
191193 // TODO: we might want to have a pop-up with the content here, instead of a link to the page.
192 - $this->getOutput()->addWikiMsgArray( 'contest-welcome-rules', $contest->getField( 'rules_page' ) );
 194+ $this->getOutput()->addWikiMsgArray( 'contest-welcome-rules', $contest->getField( 'rules_page' ) );
193195 }
194196
195197 /**
Index: trunk/extensions/Contest/specials/SpecialEditContest.php
@@ -312,7 +312,11 @@
313313 if ( $idString == '' ) {
314314 return true;
315315 }
316 -
 316+ global $wgContestDeletionEnabled;
 317+ if ( !$wgContestDeletionEnabled ) {
 318+ // Shouldn't get here (UI should prevent it)
 319+ throw new MWException( 'Contest deletion is disabled', 'contestdeletiondisabled' );
 320+ }
317321 return ContestChallenge::s()->delete( array( 'id' => explode( '|', $idString ) ) );
318322 }
319323
Index: trunk/extensions/Contest/resources/contest.special.editcontest.js
@@ -80,14 +80,16 @@
8181 ).append( '<br />' ).append( this.textInput )
8282 );
8383
84 - this.deleteButton = $( '<button />' )
85 - .button( { 'label': mw.msg( 'contest-edit-delete' ) } )
86 - .click( function() {
87 - if ( confirm( mw.msg( 'contest-edit-confirm-delete' ) ) ) {
88 - _this.remove();
89 - return false;
90 - }
91 - } );
 84+ if ( mw.config.get( 'ContestDeletionEnabled' ) ) {
 85+ this.deleteButton = $( '<button />' )
 86+ .button( { 'label': mw.msg( 'contest-edit-delete' ) } )
 87+ .click( function() {
 88+ if ( confirm( mw.msg( 'contest-edit-confirm-delete' ) ) ) {
 89+ _this.remove();
 90+ return false;
 91+ }
 92+ } );
 93+ }
9294
9395 $this.append( this.deleteButton );
9496 };

Follow-up revisions

RevisionCommit summaryAuthorDate
r100437Followup r100436, put the code in the right placereedy18:53, 21 October 2011
r100438follow up r100437 r100436jeroendedauw19:05, 21 October 2011
r1004401.18wmf1 REL r100402, r100405, r100419, r100427, r100432, r100433, r100435, r...reedy19:22, 21 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r1004321st attempt at disabling deletion...reedy17:37, 21 October 2011

Status & tagging log