From f91271f3334ab0cb19469384531861048a0c2780 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sat, 18 Mar 2006 19:22:33 +0000 Subject: [PATCH] (bug 4611) Add user preference (default on) to add new pages to creators's watchlist --- RELEASE-NOTES | 2 +- includes/DefaultSettings.php | 1 + includes/EditPage.php | 18 ++++++++++++------ includes/SpecialPreferences.php | 1 + languages/Language.php | 1 + languages/Messages.php | 1 + 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 350ca5d852..3d18e3e29a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -703,7 +703,7 @@ fully support the editing toolbar, but was found to be too confusing. reliable beyond the hostname where it's used for the spam bulk checker. * Don't URL-decode in the title attribute for URL links; it can produce false 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 === Caveats === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1daf9e322b..5338303c10 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1435,6 +1435,7 @@ $wgDefaultSkin = 'monobook'; * */ $wgDefaultUserOptions = array(); +$wgDefaultUserOptions['watchcreations'] = 1; /** Whether or not to allow and use real name fields. Defaults to true. */ $wgAllowRealName = true; diff --git a/includes/EditPage.php b/includes/EditPage.php index 480533c1b5..b47dce7df2 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -830,13 +830,19 @@ class EditPage { // activate checkboxes if user wants them to be always active if( !$this->preview && !$this->diff ) { - if( $wgUser->getOption( 'watchdefault' ) ) $this->watchthis = true; + # Sort out the "watch" checkbox + if( $wgUser->getOption( 'watchdefault' ) ) { + # Watch all edits + $this->watchthis = true; + } elseif( $wgUser->getOption( 'watchcreations' ) && !$this->mTitle->exists() ) { + # Watch creations + $this->watchthis = true; + } elseif( $this->mTitle->userIsWatching() ) { + # Already watched + $this->watchthis = true; + } + if( $wgUser->getOption( 'minordefault' ) ) $this->minoredit = true; - - // activate checkbox also if user is already watching the page, - // require wpWatchthis to be unset so that second condition is not - // checked unnecessarily - if( !$this->watchthis && $this->mTitle->userIsWatching() ) $this->watchthis = true; } $minoredithtml = ''; diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 5221ddfd91..fa7f9da0df 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -812,6 +812,7 @@ class PreferencesForm { 'showtoolbar', 'previewonfirst', 'previewontop', + 'watchcreations', 'watchdefault', 'minordefault', 'externaleditor', diff --git a/languages/Language.php b/languages/Language.php index 78b596ff72..103480e99c 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -143,6 +143,7 @@ $wgDateFormatsEn = array( 'showtoc', 'rememberpassword', 'editwidth', + 'watchcreations', 'watchdefault', 'minordefault', 'previewontop', diff --git a/languages/Messages.php b/languages/Messages.php index 248d2e3d5e..8ed32497dd 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -45,6 +45,7 @@ parent class in order maintain consistency across languages. 'tog-showtoc' => 'Show table of contents (for pages with more than 3 headings)', 'tog-rememberpassword' => 'Remember across sessions', 'tog-editwidth' => 'Edit box has full width', +'tog-watchcreations' => 'Add pages you create to your watchlist', 'tog-watchdefault' => 'Add pages you edit to your watchlist', 'tog-minordefault' => 'Mark all edits minor by default', 'tog-previewontop' => 'Show preview before edit box', -- 2.20.1