(bug 4729) Add user preference that marks a user's edits as patrolled if user is...
authorRob Church <robchurch@users.mediawiki.org>
Sat, 18 Mar 2006 22:47:40 +0000 (22:47 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 18 Mar 2006 22:47:40 +0000 (22:47 +0000)
RELEASE-NOTES
includes/Article.php
includes/RecentChange.php
includes/SpecialPreferences.php
languages/Language.php
languages/Messages.php

index e282a77..f151e54 100644 (file)
@@ -705,7 +705,7 @@ fully support the editing toolbar, but was found to be too confusing.
   results that don't code back to their original values.
 * (bug 4611) Add user preference (default on) to add new pages to creators's watchlist
 * (bug 5286) Fix regression in display of missing/bad revision IDs
-
+* (bug 4729) Add user preference that marks a user's edits as patrolled if user is able to
 
 === Caveats ===
 
index cdfe643..2d00bf1 100644 (file)
@@ -1215,8 +1215,12 @@ class Article {
                Article::onArticleCreate( $this->mTitle );
                if(!$suppressRC) {
                        require_once( 'RecentChange.php' );
-                       RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default',
+                       $rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, 'default',
                          '', strlen( $text ), $revisionId );
+                       # Mark as patrolled if the user can and has the option set
+                       if( $wgUser->isAllowed( 'patrol' ) && $wgUser->getOption( 'autopatrol' ) ) {
+                               RecentChange::markPatrolled( $rcid );
+                       }
                }
 
                if ($watchthis) {
@@ -1424,9 +1428,15 @@ class Article {
                                # Update recentchanges and purge cache and whatnot
                                require_once( 'RecentChange.php' );
                                $bot = (int)($wgUser->isBot() || $forceBot);
-                               RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary,
+                               $rcid = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $wgUser, $summary,
                                        $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
                                        $revisionId );
+                                       
+                               # Mark as patrolled if the user can do so and has it set in their options
+                               if( $wgUser->isAllowed( 'patrol' ) && $wgUser->getOption( 'autopatrol' ) ) {
+                                       RecentChange::markPatrolled( $rcid );
+                               }
+                                       
                                $dbw->commit();
 
                                // Update caches outside the main transaction
index 1a24458..06f9ce0 100644 (file)
@@ -116,10 +116,8 @@ class RecentChange
                # Insert new row
                $dbw->insert( 'recentchanges', $this->mAttribs, $fname );
 
-               if ( $wgUseRCPatrol ) {
-                       # Retrieve the id assigned by the db, but only if we'll use it later
-                       $this->mAttribs['rc_id'] = $dbw->insertId();
-               }
+               # Set the ID
+               $this->mAttribs['rc_id'] = $dbw->insertId();
 
                # Update old rows, if necessary
                if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
@@ -242,6 +240,7 @@ class RecentChange
                        'newSize'       => $newSize,
                );
                $rc->save();
+               return( $rc->mAttribs['rc_id'] );
        }
 
        # Makes an entry in the database corresponding to page creation
index fa7f9da..7af9b26 100644 (file)
@@ -817,9 +817,11 @@ class PreferencesForm {
                                'minordefault',
                                'externaleditor',
                                'externaldiff',
-                               $wgLivePreview ? 'uselivepreview' : false, )
+                               $wgLivePreview ? 'uselivepreview' : false,
+                               $wgUser->isAllowed( 'patrol' ) ? 'autopatrol' : false, )
                        ) . '</fieldset>'
                );
+               $this->mUsedToggles['autopatrol'] = true; # Don't show this up for users who can't; the handler below is dumb and doesn't know it
 
                $wgOut->addHTML( '<fieldset><legend>' . htmlspecialchars(wfMsg('prefs-rc')) . '</legend>' .
                                        '<label for="wpRecent">' . wfMsg ( 'recentchangescount' ) .
index 103480e..c7e853d 100644 (file)
@@ -159,6 +159,7 @@ $wgDateFormatsEn = array(
        'externaldiff',
        'showjumplinks',
        'uselivepreview',
+       'autopatrol',
 );
 
 /* private */ $wgBookstoreListEn = array(
index 8ed3249..fb7acbb 100644 (file)
@@ -61,6 +61,7 @@ parent class in order maintain consistency across languages.
 'tog-externaldiff' => 'Use external diff by default',
 'tog-showjumplinks' => 'Enable "jump to" accessibility links',
 'tog-uselivepreview' => 'Use live preview (JavaScript) (Experimental)',
+'tog-autopatrol' => 'Mark edits I make as patrolled',
 
 'underline-always' => 'Always',
 'underline-never' => 'Never',