mirror of
https://github.com/spacebarchat/client.git
synced 2024-11-22 02:12:38 +01:00
messages: show mention background color
This commit is contained in:
parent
fc7308d536
commit
fda6f6972e
@ -26,8 +26,20 @@ function Message({ message, header }: Props) {
|
||||
...ContextMenus.Message(app, message, app.account),
|
||||
]);
|
||||
|
||||
const guild = message.guild_id ? app.guilds.get(message.guild_id) : undefined;
|
||||
const isEveryoneMentioned = "mention_everyone" in message && message.mention_everyone;
|
||||
const isUserMentioned = "mentions" in message && message.mentions.some((mention) => mention.id === app.account!.id);
|
||||
const isRoleMentioned =
|
||||
guild &&
|
||||
"mention_roles" in message &&
|
||||
message.mention_roles.some((role) => guild.members.me?.roles.some((role) => role.id === role.id));
|
||||
|
||||
return (
|
||||
<MessageBase header={header} onContextMenu={(e) => contextMenu.open2(e, contextMenuItems)}>
|
||||
<MessageBase
|
||||
header={header}
|
||||
onContextMenu={(e) => contextMenu.open2(e, contextMenuItems)}
|
||||
mention={isEveryoneMentioned || isUserMentioned || isRoleMentioned}
|
||||
>
|
||||
<MessageInfo>
|
||||
{header ? (
|
||||
<Avatar key={message.author.id} user={message.author} size={40} />
|
||||
|
@ -213,7 +213,7 @@ export default class Message extends MessageBase {
|
||||
this.tts = data.tts;
|
||||
this.mention_everyone = data.mention_everyone;
|
||||
this.mentions = data.mentions; // TODO: user object?
|
||||
this.mention_roles = data.mention_roles;
|
||||
this.mention_roles = (data.mention_roles as unknown as { id: Snowflake }[]).map((x) => x.id); // FIXME: oh god, who did this in the server smh
|
||||
this.mention_channels = data.mention_channels;
|
||||
this.attachments = data.attachments;
|
||||
this.embeds = data.embeds;
|
||||
|
Loading…
Reference in New Issue
Block a user