feat: use primary identity display name in switcher dropdown

The account switcher dropdown previously showed the IMAP username
(typically the email address) for the primary account. Now it falls
back to the identity's display name when available, matching the
behavior of secondary accounts which use their custom label.

Priority order: global_alias session var > primary identity display
name > IMAP username.
This commit is contained in:
Laurent Dinclaux
2026-05-06 17:37:50 +11:00
parent bea25d8396
commit e539c60e9b
2 changed files with 7 additions and 2 deletions

View File

@@ -188,7 +188,9 @@ class ident_switch extends rcube_plugin
$iid = intval($iid_s);
}
$accNames = [$_SESSION['global_alias'] ?? $rc->user->data['username']];
$primaryIdentity = $rc->user->get_identity();
$primaryName = !empty($primaryIdentity['name']) ? $primaryIdentity['name'] : null;
$accNames = [$_SESSION['global_alias'] ?? $primaryName ?? $rc->user->data['username']];
$accValues = [-1];
$accSelected = -1;
$iidMap = [0 => -1]; // primary account: iid 0 → select value -1