mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-08-27 22:34:17 +00:00
Merge branch 'main' into fix/video-embeds
This commit is contained in:
+43
-6
@@ -466,6 +466,30 @@ class Group extends Channel {
|
||||
group: "dm",
|
||||
},
|
||||
);
|
||||
this.groupcontextmenu.addButton(
|
||||
() => I18n.channel.mute(),
|
||||
function () {
|
||||
this.muteChannel();
|
||||
},
|
||||
{
|
||||
visible: function () {
|
||||
return !this.muted && this.type !== 4;
|
||||
},
|
||||
group: "dm",
|
||||
},
|
||||
);
|
||||
this.groupcontextmenu.addButton(
|
||||
() => I18n.channel.unmute(),
|
||||
function () {
|
||||
this.unmuteChannel();
|
||||
},
|
||||
{
|
||||
visible: function () {
|
||||
return this.muted;
|
||||
},
|
||||
group: "dm",
|
||||
},
|
||||
);
|
||||
|
||||
this.groupcontextmenu.addSeperator(undefined, "dm");
|
||||
|
||||
@@ -531,7 +555,7 @@ class Group extends Channel {
|
||||
super.updateChannel(json);
|
||||
this.owner_id = json.owner_id;
|
||||
this.icon = json.icon;
|
||||
this.makeIcon();
|
||||
this.updateIcons();
|
||||
}
|
||||
defaultName() {
|
||||
return this.users.map((_) => _.name).join(", ");
|
||||
@@ -653,13 +677,26 @@ class Group extends Channel {
|
||||
this.myhtml.remove();
|
||||
}
|
||||
}
|
||||
groupDmDiv = new WeakRef(document.createElement("div"));
|
||||
makeIcon(): HTMLElement {
|
||||
updateIcons() {
|
||||
for (const ref of this.groupDmDivs) {
|
||||
const div = ref.deref();
|
||||
if (!div) {
|
||||
this.groupDmDivs.delete(ref);
|
||||
continue;
|
||||
}
|
||||
this.makeIcon(div);
|
||||
}
|
||||
}
|
||||
private groupDmDivs = new Set<WeakRef<HTMLDivElement>>();
|
||||
makeIcon(div = document.createElement("div")): HTMLDivElement {
|
||||
div.innerHTML = "";
|
||||
div.classList = "";
|
||||
if (this.type === 1) {
|
||||
return this.users[0].buildstatuspfp(this);
|
||||
div.append(this.users[0].buildstatuspfp(this));
|
||||
return div;
|
||||
} else {
|
||||
const div = this.groupDmDiv.deref() || document.createElement("div");
|
||||
div.innerHTML = "";
|
||||
this.groupDmDivs.add(new WeakRef(div));
|
||||
|
||||
div.classList.add("groupDmDiv");
|
||||
if (this.icon) {
|
||||
const img = createImg(
|
||||
|
||||
@@ -573,6 +573,7 @@ class Message extends SnowFlake {
|
||||
|
||||
mentionsuser(userd: User | Member) {
|
||||
if (this.mention_everyone) return true;
|
||||
if (this.id === "1531482863320101422") console.warn(this.mentions);
|
||||
if (userd instanceof User) {
|
||||
return !!this.mentions.has(userd.id);
|
||||
} else if (userd instanceof Member) {
|
||||
@@ -732,7 +733,7 @@ class Message extends SnowFlake {
|
||||
premessage = this.channel.messages.get(this.channel.idToPrev.get(this.id) as string);
|
||||
}
|
||||
if (
|
||||
this.mentionsuser(this.guild.member) ||
|
||||
this.mentionsuser(this.localuser.user) ||
|
||||
this.ephemeral ||
|
||||
this.interaction?.user.id === this.localuser.user.id
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user