@@ -1057,10 +1057,9 @@ void ChatMessageHeader::UpdateName() {
|
|||||||
const auto chan = discord.GetChannel(ChannelID);
|
const auto chan = discord.GetChannel(ChannelID);
|
||||||
bool is_guild = chan.has_value() && chan->GuildID.has_value();
|
bool is_guild = chan.has_value() && chan->GuildID.has_value();
|
||||||
if (is_guild) {
|
if (is_guild) {
|
||||||
const auto member = discord.GetMember(UserID, *chan->GuildID);
|
|
||||||
const auto role_id = discord.GetMemberHoistedRole(*chan->GuildID, UserID, true);
|
const auto role_id = discord.GetMemberHoistedRole(*chan->GuildID, UserID, true);
|
||||||
const auto role = discord.GetRole(role_id);
|
const auto role = discord.GetRole(role_id);
|
||||||
const auto name = GetEscapedDisplayName(*user, member);
|
const auto name = user->GetDisplayNameEscaped(*chan->GuildID);
|
||||||
|
|
||||||
std::string md;
|
std::string md;
|
||||||
if (role.has_value())
|
if (role.has_value())
|
||||||
@@ -1090,13 +1089,6 @@ void ChatMessageHeader::AttachUserMenuHandler(Gtk::Widget &widget) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring ChatMessageHeader::GetEscapedDisplayName(const UserData &user, const std::optional<GuildMember> &member) {
|
|
||||||
if (member.has_value() && !member->Nickname.empty())
|
|
||||||
return Glib::Markup::escape_text(member->Nickname);
|
|
||||||
else
|
|
||||||
return Glib::Markup::escape_text(user.GetDisplayNameEscaped());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChatMessageHeader::on_author_button_press(GdkEventButton *ev) {
|
bool ChatMessageHeader::on_author_button_press(GdkEventButton *ev) {
|
||||||
if (ev->button == GDK_BUTTON_PRIMARY && (ev->state & GDK_SHIFT_MASK)) {
|
if (ev->button == GDK_BUTTON_PRIMARY && (ev->state & GDK_SHIFT_MASK)) {
|
||||||
m_signal_action_insert_mention.emit();
|
m_signal_action_insert_mention.emit();
|
||||||
|
@@ -84,7 +84,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AttachUserMenuHandler(Gtk::Widget &widget);
|
void AttachUserMenuHandler(Gtk::Widget &widget);
|
||||||
static Glib::ustring GetEscapedDisplayName(const UserData &user, const std::optional<GuildMember> &member);
|
|
||||||
|
|
||||||
bool on_author_button_press(GdkEventButton *ev);
|
bool on_author_button_press(GdkEventButton *ev);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user