mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-29 02:10:59 -05:00
fix(notifications): use effective name and avatar for notif
This commit is contained in:
parent
8eabc47915
commit
71c0a782c1
1 changed files with 11 additions and 4 deletions
|
@ -63,22 +63,24 @@ function Notifier({ options, notifs }: Props) {
|
||||||
playSound("message");
|
playSound("message");
|
||||||
if (!showNotification) return;
|
if (!showNotification) return;
|
||||||
|
|
||||||
|
const effectiveName = msg.masquerade?.name ?? msg.author?.username;
|
||||||
|
|
||||||
let title;
|
let title;
|
||||||
switch (msg.channel?.channel_type) {
|
switch (msg.channel?.channel_type) {
|
||||||
case "SavedMessages":
|
case "SavedMessages":
|
||||||
return;
|
return;
|
||||||
case "DirectMessage":
|
case "DirectMessage":
|
||||||
title = `@${msg.author?.username}`;
|
title = `@${effectiveName}`;
|
||||||
break;
|
break;
|
||||||
case "Group":
|
case "Group":
|
||||||
if (msg.author?._id === "00000000000000000000000000") {
|
if (msg.author?._id === "00000000000000000000000000") {
|
||||||
title = msg.channel.name;
|
title = msg.channel.name;
|
||||||
} else {
|
} else {
|
||||||
title = `@${msg.author?.username} - ${msg.channel.name}`;
|
title = `@${effectiveName} - ${msg.channel.name}`;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "TextChannel":
|
case "TextChannel":
|
||||||
title = `@${msg.author?.username} (#${msg.channel.name}, ${msg.channel.server?.name})`;
|
title = `@${effectiveName} (#${msg.channel.name}, ${msg.channel.server?.name})`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
title = msg.channel?._id;
|
title = msg.channel?._id;
|
||||||
|
@ -100,7 +102,12 @@ function Notifier({ options, notifs }: Props) {
|
||||||
let body, icon;
|
let body, icon;
|
||||||
if (typeof msg.content === "string") {
|
if (typeof msg.content === "string") {
|
||||||
body = client.markdownToText(msg.content);
|
body = client.markdownToText(msg.content);
|
||||||
|
|
||||||
|
if (msg.masquerade?.avatar) {
|
||||||
|
icon = client.proxyFile(msg.masquerade.avatar);
|
||||||
|
} else {
|
||||||
icon = msg.author?.generateAvatarURL({ max_side: 256 });
|
icon = msg.author?.generateAvatarURL({ max_side: 256 });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const users = client.users;
|
const users = client.users;
|
||||||
switch (msg.content.type) {
|
switch (msg.content.type) {
|
||||||
|
|
Loading…
Reference in a new issue