Index: trunk/phase3/includes/WatchlistEditor.php |
— | — | @@ -44,23 +44,30 @@ |
45 | 45 | case self::EDIT_RAW: |
46 | 46 | $output->setPageTitle( wfMsg( 'watchlistedit-raw-title' ) ); |
47 | 47 | if( $request->wasPosted() && $this->checkToken( $request, $wgUser ) ) { |
| 48 | + $wanted = $this->extractTitles( $request->getText( 'titles' ) ); |
48 | 49 | $current = $this->getWatchlist( $user ); |
49 | | - $wanted = $this->extractTitles( $request->getText( 'titles' ) ); |
50 | | - $toWatch = array_diff( $wanted, $current ); |
51 | | - $toUnwatch = array_diff( $current, $wanted ); |
52 | | - $this->watchTitles( $toWatch, $user ); |
53 | | - $this->unwatchTitles( $toUnwatch, $user ); |
54 | | - $user->invalidateCache(); |
55 | | - if( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) |
56 | | - $output->addHtml( wfMsgExt( 'watchlistedit-raw-done', 'parse' ) ); |
57 | | - if( ( $count = count( $toWatch ) ) > 0 ) { |
58 | | - $output->addHtml( wfMsgExt( 'watchlistedit-raw-added', 'parse', $count ) ); |
59 | | - $this->showTitles( $toWatch, $output, $wgUser->getSkin() ); |
| 50 | + if( count( $wanted ) > 0 ) { |
| 51 | + $toWatch = array_diff( $wanted, $current ); |
| 52 | + $toUnwatch = array_diff( $current, $wanted ); |
| 53 | + $this->watchTitles( $toWatch, $user ); |
| 54 | + $this->unwatchTitles( $toUnwatch, $user ); |
| 55 | + $user->invalidateCache(); |
| 56 | + if( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) |
| 57 | + $output->addHtml( wfMsgExt( 'watchlistedit-raw-done', 'parse' ) ); |
| 58 | + if( ( $count = count( $toWatch ) ) > 0 ) { |
| 59 | + $output->addHtml( wfMsgExt( 'watchlistedit-raw-added', 'parse', $count ) ); |
| 60 | + $this->showTitles( $toWatch, $output, $wgUser->getSkin() ); |
| 61 | + } |
| 62 | + if( ( $count = count( $toUnwatch ) ) > 0 ) { |
| 63 | + $output->addHtml( wfMsgExt( 'watchlistedit-raw-removed', 'parse', $count ) ); |
| 64 | + $this->showTitles( $toUnwatch, $output, $wgUser->getSkin() ); |
| 65 | + } |
| 66 | + } else { |
| 67 | + $this->clearWatchlist( $user ); |
| 68 | + $user->invalidateCache(); |
| 69 | + $output->addHtml( wfMsgExt( 'watchlistedit-raw-removed', 'parse', count( $current ) ) ); |
| 70 | + $this->showTitles( $current, $output, $wgUser->getSkin() ); |
60 | 71 | } |
61 | | - if( ( $count = count( $toUnwatch ) ) > 0 ) { |
62 | | - $output->addHtml( wfMsgExt( 'watchlistedit-raw-removed', 'parse', $count ) ); |
63 | | - $this->showTitles( $toUnwatch, $output, $wgUser->getSkin() ); |
64 | | - } |
65 | 72 | } |
66 | 73 | $this->showRawForm( $output, $user ); |
67 | 74 | break; |