Index: branches/apiedit/phase3/RELEASE-NOTES |
— | — | @@ -113,6 +113,7 @@ |
114 | 114 | * (bug 10387) Detect and handle '.php5' extension environments at install time |
115 | 115 | Patch by Edward Z. Yang. |
116 | 116 | * Introduce 'ShowRawCssJs' hook; see docs/hooks.txt for more information |
| 117 | +* (bug 10404) Show rights log fragment for the selected user in Special:Userrights |
117 | 118 | |
118 | 119 | == Bugfixes since 1.10 == |
119 | 120 | |
Index: branches/apiedit/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1273,10 +1273,9 @@ |
1274 | 1274 | 'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to. |
1275 | 1275 | Unselected groups will not be changed. You can deselect a group with CTRL + Left Click', |
1276 | 1276 | 'userrights-reason' => 'Reason for change:', |
1277 | | -'userrights-list' => 'Because you are a member of $1, you can add $2 and remove $3.', |
1278 | | -'userrights-list-nogroups' => 'no groups', |
1279 | | -'userrights-list-groups' => 'the {{PLURAL:$1|group|groups}} $2', |
1280 | | -'userrights-list-separator' => ', ', # only translate this message to other languages if you have to change it |
| 1277 | +'userrights-available-none' => 'You may not alter group membership.', |
| 1278 | +'userrights-available-add' => 'You can add users to $1.', |
| 1279 | +'userrights-available-remove' => 'You can remove users from $1.', |
1281 | 1280 | |
1282 | 1281 | # Groups |
1283 | 1282 | 'group' => 'Group:', |
Index: branches/apiedit/phase3/maintenance/language/messages.inc |
— | — | @@ -693,10 +693,9 @@ |
694 | 694 | 'userrights-groupsavailable', |
695 | 695 | 'userrights-groupshelp', |
696 | 696 | 'userrights-reason', |
697 | | - 'userrights-list', |
698 | | - 'userrights-list-nogroups', |
699 | | - 'userrights-list-groups', |
700 | | - 'userrights-list-separator', |
| 697 | + 'userrights-available-none', |
| 698 | + 'userrights-available-add', |
| 699 | + 'userrights-available-remove', |
701 | 700 | ), |
702 | 701 | 'group' => array( |
703 | 702 | 'group', |
Index: branches/apiedit/phase3/includes/Wiki.php |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | $lang->findVariantLink( $title, $ret ); |
100 | 100 | |
101 | 101 | } |
102 | | - if ( $oldid = $request->getInt( 'oldid' ) ) { |
| 102 | + if ( $ret->getNamespace() != NS_SPECIAL && $oldid = $request->getInt( 'oldid' ) ) { |
103 | 103 | // Allow oldid to override a changed or missing title. |
104 | 104 | $rev = Revision::newFromId( $oldid ); |
105 | 105 | if( $rev ) { |
Index: branches/apiedit/phase3/includes/SpecialUserrights.php |
— | — | @@ -154,6 +154,7 @@ |
155 | 155 | } |
156 | 156 | |
157 | 157 | $this->showEditUserGroupsForm( $username, $user->getGroups() ); |
| 158 | + $this->showLogFragment( $user, $wgOut ); |
158 | 159 | } |
159 | 160 | |
160 | 161 | /** |
— | — | @@ -229,51 +230,24 @@ |
230 | 231 | } |
231 | 232 | |
232 | 233 | /** |
233 | | - * Explains what groups the user can add and remove, and why. |
| 234 | + * Prepare a list of groups the user is able to add and remove |
234 | 235 | * |
235 | | - * @return string Explanatory sanitized HTML message |
| 236 | + * @return string |
236 | 237 | */ |
237 | 238 | private function explainRights() { |
238 | | - global $wgUser; |
239 | | - $groups = $wgUser->getEffectiveGroups(); |
240 | | - foreach( $groups as $group ) { |
241 | | - if( $this->changeableByGroup( $group ) == array( |
242 | | - 'add' => array(), |
243 | | - 'remove' => array() |
244 | | - ) ) { |
245 | | - // Can't add or remove anything, ignore this group |
246 | | - $groups = array_diff( $groups, array( $group ) ); |
247 | | - } |
248 | | - } |
249 | | - $grouplists = array( $groups ); |
250 | | - list( $grouplists[1], $grouplists[2] ) = array_values( $this->changeableGroups() ); |
| 239 | + global $wgUser, $wgLang; |
251 | 240 | |
252 | | - // Now format them nicely for display (yay mutable variables? I'm sick |
253 | | - // of thinking up new names) |
254 | | - foreach( $grouplists as &$list ) { |
255 | | - if( $list == array() ) { |
256 | | - $list = wfMsgExt( 'userrights-list-nogroups', 'parseinline' ); |
257 | | - } else { |
258 | | - $list = wfMsgExt( |
259 | | - 'userrights-list-groups', |
260 | | - 'parseinline', |
261 | | - count( $list ), |
262 | | - implode( |
263 | | - $list, |
264 | | - wfMsgHtml( 'userrights-list-separator' ) |
265 | | - ) |
266 | | - ); |
267 | | - } |
268 | | - } |
| 241 | + $out = array(); |
| 242 | + list( $add, $remove ) = array_values( $this->changeableGroups() ); |
269 | 243 | |
270 | | - return wfMsgExt( |
271 | | - 'userrights-list', |
272 | | - 'parse', |
273 | | - $grouplists[0], |
274 | | - $grouplists[1], |
275 | | - $grouplists[2] |
276 | | - ); |
277 | | - |
| 244 | + if( count( $add ) > 0 ) |
| 245 | + $out[] = wfMsgExt( 'userrights-available-add', 'parseinline', $wgLang->listToText( $add ) ); |
| 246 | + if( count( $remove ) > 0 ) |
| 247 | + $out[] = wfMsgExt( 'userrights-available-remove', 'parseinline', $wgLang->listToText( $remove ) ); |
| 248 | + |
| 249 | + return count( $out ) > 0 |
| 250 | + ? implode( ' ', $out ) |
| 251 | + : wfMsgExt( 'userrights-available-none', 'parseinline' ); |
278 | 252 | } |
279 | 253 | |
280 | 254 | /** |
— | — | @@ -403,5 +377,26 @@ |
404 | 378 | } |
405 | 379 | return $groups; |
406 | 380 | } |
407 | | -} // end class UserrightsForm |
408 | | - |
| 381 | + |
| 382 | + /** |
| 383 | + * Show a rights log fragment for the specified user |
| 384 | + * |
| 385 | + * @param User $user User to show log for |
| 386 | + * @param OutputPage $output OutputPage to use |
| 387 | + */ |
| 388 | + protected function showLogFragment( $user, $output ) { |
| 389 | + $viewer = new LogViewer( |
| 390 | + new LogReader( |
| 391 | + new FauxRequest( |
| 392 | + array( |
| 393 | + 'type' => 'rights', |
| 394 | + 'page' => $user->getUserPage()->getPrefixedUrl(), |
| 395 | + ) |
| 396 | + ) |
| 397 | + ) |
| 398 | + ); |
| 399 | + $output->addHtml( "<h2>" . htmlspecialchars( LogPage::logName( 'rights' ) ) . "</h2>\n" ); |
| 400 | + $viewer->showList( $output ); |
| 401 | + } |
| 402 | + |
| 403 | +} |
\ No newline at end of file |
Index: branches/apiedit/phase3/includes/UserMailer.php |
— | — | @@ -373,6 +373,7 @@ |
374 | 374 | ), array( /* WHERE */ |
375 | 375 | 'wl_title' => $title->getDBkey(), |
376 | 376 | 'wl_namespace' => $title->getNamespace(), |
| 377 | + 'wl_notificationtimestamp' => NULL |
377 | 378 | ), 'UserMailer::NotifyOnChange' |
378 | 379 | ); |
379 | 380 | # FIXME what do we do on failure ? |