Update personal tools for temp users, add icon for temp users

Bug: T335546
Change-Id: I56315440016cde3aad051b37895f713fbb5dd239
This commit is contained in:
bwang 2023-06-20 11:18:13 -05:00
parent 33b2b037a7
commit d977c8d940
2 changed files with 11 additions and 1 deletions

View file

@ -20,6 +20,7 @@
namespace MediaWiki\Minerva\Menu\Main;
use MediaWiki\MediaWikiServices;
use MediaWiki\Minerva\Menu\Definitions;
use MediaWiki\Minerva\Menu\Entries\SingleMenuEntry;
use MediaWiki\Minerva\Menu\Group;
@ -101,7 +102,10 @@ final class DefaultMainMenuBuilder implements IMainMenuBuilder {
*/
public function getSettingsGroup(): Group {
$group = new Group( 'pt-preferences' );
if ( $this->showMobileOptions && !$this->user->isRegistered() ) {
// Show settings group for anon and temp users
$userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
$isTemp = $userNameUtils->isTemp( $this->user->getName() );
if ( $this->showMobileOptions && ( !$this->user->isRegistered() || $isTemp ) ) {
$this->definitions->insertMobileOptionsItem( $group );
}
return $group;
@ -125,6 +129,11 @@ final class DefaultMainMenuBuilder implements IMainMenuBuilder {
[ 'login' ]
);
}
$userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
$isTemp = $userNameUtils->isTemp( $this->user->getName() );
if ( $isTemp ) {
$excludeKeyList[] = 'mycontris';
}
foreach ( $personalTools as $key => $item ) {
$href = $item['href'] ?? null;
if ( $href && !in_array( $key, $excludeKeyList ) ) {

View file

@ -366,6 +366,7 @@
"menu",
"search",
"userAvatar",
"userAnonymous",
"userTalk",
"star",
"halfStar",