Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js |
— | — | @@ -99,7 +99,16 @@ |
100 | 100 | } ).click( function() { |
101 | 101 | if ( confirm( mediaWiki.msg( 'swl-group-confirmdelete', self.nameInput.val() ) ) ) { |
102 | 102 | 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 | + } ); |
104 | 113 | } |
105 | 114 | } ) |
106 | 115 | ); |
— | — | @@ -148,7 +157,7 @@ |
149 | 158 | 'ids': this.group.id |
150 | 159 | }, |
151 | 160 | function( data ) { |
152 | | - callback(); |
| 161 | + callback( data.success ); |
153 | 162 | } |
154 | 163 | ); |
155 | 164 | } |
Index: trunk/extensions/SemanticWatchlist/api/ApiDeleteWatchlistGroup.php |
— | — | @@ -27,18 +27,29 @@ |
28 | 28 | |
29 | 29 | $params = $this->extractRequestParams(); |
30 | 30 | |
| 31 | + $everythingOk = true; |
| 32 | + |
31 | 33 | $dbw = wfGetDB( DB_MASTER ); |
32 | | - |
33 | 34 | $dbw->begin(); |
34 | 35 | |
35 | 36 | foreach ( $params['ids'] as $id ) { |
36 | | - $dbw->delete( |
| 37 | + $result = $dbw->delete( |
37 | 38 | 'swl_groups', |
38 | 39 | array( 'group_id' => $id ) |
39 | | - ); |
| 40 | + ); |
| 41 | + |
| 42 | + if ( $result === false ) { |
| 43 | + $everythingOk = false; |
| 44 | + } |
40 | 45 | } |
41 | 46 | |
42 | 47 | $dbw->commit(); |
| 48 | + |
| 49 | + $this->getResult()->addValue( |
| 50 | + null, |
| 51 | + 'success', |
| 52 | + $everythingOk |
| 53 | + ); |
43 | 54 | } |
44 | 55 | |
45 | 56 | public function getAllowedParams() { |