show legacy username as tooltip under username

This commit is contained in:
ouwou
2023-06-21 02:31:18 -04:00
parent 00dddf410e
commit 19f7d55c87
3 changed files with 8 additions and 1 deletions

View File

@@ -463,6 +463,7 @@ void from_json(const nlohmann::json &j, UserProfileData &m) {
JS_D("mutual_guilds", m.MutualGuilds);
JS_ON("premium_guild_since", m.PremiumGuildSince);
JS_ON("premium_since", m.PremiumSince);
JS_ON("legacy_username", m.LegacyUsername);
JS_D("user", m.User);
}

View File

@@ -617,6 +617,7 @@ struct UserProfileData {
std::vector<MutualGuildData> MutualGuilds;
std::optional<std::string> PremiumGuildSince; // null
std::optional<std::string> PremiumSince; // null
std::optional<std::string> LegacyUsername; // null
UserData User;
friend void from_json(const nlohmann::json &j, UserProfileData &m);

View File

@@ -103,8 +103,13 @@ void ProfileWindow::OnFetchProfile(const UserProfileData &data) {
m_pane_info.SetProfile(data);
m_pane_guilds.SetMutualGuilds(data.MutualGuilds);
for (auto child : m_badges.get_children())
if (data.LegacyUsername.has_value()) {
m_username.set_tooltip_text("Originally known as " + *data.LegacyUsername);
}
for (auto child : m_badges.get_children()) {
delete child;
}
if (!data.User.PublicFlags.has_value()) return;
const auto x = *data.User.PublicFlags;