Skip to content

A platform for community discussion. Free, open, simple.

DEV: use DButton for user header avatar menu (#32687)

Kris0658773056e9
diff --git a/app/assets/javascripts/discourse/app/components/header/user-dropdown.gjs b/app/assets/javascripts/discourse/app/components/header/user-dropdown.gjs
index 2fdf1b6d1b4..cc1e8c4696f 100644
--- a/app/assets/javascripts/discourse/app/components/header/user-dropdown.gjs
+++ b/app/assets/javascripts/discourse/app/components/header/user-dropdown.gjs
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
-import { or } from "truth-helpers";
+import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet";
import concatClass from "discourse/helpers/concat-class";
import { wantsNewWindow } from "discourse/lib/intercept-click";
@@ -35,19 +35,17 @@ export default class UserDropdown extends Component {
}}
>
<PluginOutlet @name="user-dropdown-button__before" />
- <button
+ <DButton
id="toggle-current-user"
class="icon btn-flat"
aria-haspopup="true"
aria-expanded={{@active}}
- aria-label={{i18n
- "user.account_possessive"
- name=(or this.currentUser.name this.currentUser.username)
- }}
+ aria-label={{i18n "user.avatar.header_title"}}
+ title={{i18n "user.avatar.header_title"}}
{{on "click" this.click}}
>
<Notifications @active={{@active}} />
- </button>
+ </DButton>
<PluginOutlet @name="user-dropdown-button__after" />
</li>
</template>
diff --git a/app/assets/javascripts/discourse/app/components/header/user-dropdown/notifications.gjs b/app/assets/javascripts/discourse/app/components/header/user-dropdown/notifications.gjs
index 95cdbb58ff2..43ce7a2f134 100644
--- a/app/assets/javascripts/discourse/app/components/header/user-dropdown/notifications.gjs
+++ b/app/assets/javascripts/discourse/app/components/header/user-dropdown/notifications.gjs
@@ -24,7 +24,7 @@ export default class Notifications extends Component {
return htmlSafe(
renderAvatar(this.currentUser, {
imageSize: this.avatarSize,
- title: i18n("user.avatar.header_title"),
+ hideTitle: true,
template: this.currentUser.avatar_template,
username: this.currentUser.username,
name: this.siteSettings.enable_names && this.currentUser.name,
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 960d1d52860..604f3cf3f25 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1260,7 +1260,6 @@ en:
said: "%{username}:"
profile: "Profile"
profile_possessive: "%{username}'s profile"
- account_possessive: "%{name}'s account"
mute: "Mute"
edit: "Edit Preferences"
download_archive:
@@ -2158,7 +2157,7 @@ en:
title: "Registration IP Address"
avatar:
title: "Profile Picture"
- header_title: "profile, messages, bookmarks and preferences"
+ header_title: "Notifications and account"
name_and_description: "%{name} - %{description}"
edit: "Edit Profile Picture"
title:
@@ -3145,7 +3144,7 @@ en:
additional_options:
label: "Filter by post count and topic views"
- hamburger_menu: "menu"
+ hamburger_menu: "Navigation menu"
new_item: "new"
go_back: "go back"
not_logged_in_user: "user page with summary of current activity and preferences"