r88427 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88426‎ | r88427 | r88428 >
Date:20:53, 19 May 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
implemented watchlist group delete stuff
Modified paths:
  • /trunk/extensions/SemanticWatchlist/api/ApiDeleteWatchlistGroup.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
@@ -99,7 +99,16 @@
100100 } ).click( function() {
101101 if ( confirm( mediaWiki.msg( 'swl-group-confirmdelete', self.nameInput.val() ) ) ) {
102102 this.disabled = true;
103 - self.doDelete( function() { this.disabled = false; } );
 103+
 104+ self.doDelete( function( success ) {
 105+ if ( success ) {
 106+ self.slideUp( 'fast' );
 107+ }
 108+ else {
 109+ alert( 'Could not delete the watchlist group.' );
 110+ this.disabled = false;
 111+ }
 112+ } );
104113 }
105114 } )
106115 );
@@ -148,7 +157,7 @@
149158 'ids': this.group.id
150159 },
151160 function( data ) {
152 - callback();
 161+ callback( data.success );
153162 }
154163 );
155164 }
Index: trunk/extensions/SemanticWatchlist/api/ApiDeleteWatchlistGroup.php
@@ -27,18 +27,29 @@
2828
2929 $params = $this->extractRequestParams();
3030
 31+ $everythingOk = true;
 32+
3133 $dbw = wfGetDB( DB_MASTER );
32 -
3334 $dbw->begin();
3435
3536 foreach ( $params['ids'] as $id ) {
36 - $dbw->delete(
 37+ $result = $dbw->delete(
3738 'swl_groups',
3839 array( 'group_id' => $id )
39 - );
 40+ );
 41+
 42+ if ( $result === false ) {
 43+ $everythingOk = false;
 44+ }
4045 }
4146
4247 $dbw->commit();
 48+
 49+ $this->getResult()->addValue(
 50+ null,
 51+ 'success',
 52+ $everythingOk
 53+ );
4354 }
4455
4556 public function getAllowedParams() {

Status & tagging log