Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -1016,8 +1016,7 @@ |
1017 | 1017 | |
1018 | 1018 | $encDestName = htmlspecialchars( $this->mDesiredDestName ); |
1019 | 1019 | |
1020 | | - $watchChecked = |
1021 | | - ( $wgUser->getOption( 'watchdefault' ) || $wgUser->getOption( 'watchcreations' ) ) |
| 1020 | + $watchChecked = $this->watchCheck() |
1022 | 1021 | ? 'checked="checked"' |
1023 | 1022 | : ''; |
1024 | 1023 | $warningChecked = $this->mIgnoreWarning ? 'checked' : ''; |
— | — | @@ -1192,6 +1191,35 @@ |
1193 | 1192 | } |
1194 | 1193 | |
1195 | 1194 | /* -------------------------------------------------------------- */ |
| 1195 | + |
| 1196 | + /** |
| 1197 | + * See if we should check the 'watch this page' checkbox on the form |
| 1198 | + * based on the user's preferences and whether we're being asked |
| 1199 | + * to create a new file or update an existing one. |
| 1200 | + * |
| 1201 | + * In the case where 'watch edits' is off but 'watch creations' is on, |
| 1202 | + * we'll leave the box unchecked. |
| 1203 | + * |
| 1204 | + * Note that the page target can be changed *on the form*, so our check |
| 1205 | + * state can get out of sync. |
| 1206 | + */ |
| 1207 | + function watchCheck() { |
| 1208 | + global $wgUser; |
| 1209 | + if( $wgUser->getOption( 'watchdefault' ) ) { |
| 1210 | + // Watch all edits! |
| 1211 | + return true; |
| 1212 | + } |
| 1213 | + |
| 1214 | + $local = wfLocalFile( $this->mDesiredDestName ); |
| 1215 | + if( $local && $local->exists() ) { |
| 1216 | + // We're uploading a new version of an existing file. |
| 1217 | + // No creation, so don't watch it if we're not already. |
| 1218 | + return $local->getTitle()->userIsWatching(); |
| 1219 | + } else { |
| 1220 | + // New page should get watched if that's our option. |
| 1221 | + return $wgUser->getOption( 'watchcreations' ); |
| 1222 | + } |
| 1223 | + } |
1196 | 1224 | |
1197 | 1225 | /** |
1198 | 1226 | * Split a file into a base name and all dot-delimited 'extensions' |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -184,7 +184,9 @@ |
185 | 185 | * (bug 13728) Don't trim initial whitespace during section edits |
186 | 186 | * (bug 13727) Don't delete log entries from recentchanges on page deletion |
187 | 187 | * (bug 13752) Section redirects now works again |
| 188 | +* (bug 13725) Upload form watch checkbox state set correctly with wpDestFile |
188 | 189 | |
| 190 | + |
189 | 191 | === API changes in 1.13 === |
190 | 192 | |
191 | 193 | * Fixing main page display in meta=siteinfo |