Implement tags into user data propogation event on channels

This commit is contained in:
Hri7566 2024-08-03 07:13:04 -04:00
parent 1abaea06fa
commit c94069bb37
2 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import {
IChannelInfo, IChannelInfo,
Notification, Notification,
UserFlags, UserFlags,
Tag,
} from "../util/types"; } from "../util/types";
import type { Socket } from "../ws/Socket"; import type { Socket } from "../ws/Socket";
import { validateChannelSettings } from "./settings"; import { validateChannelSettings } from "./settings";
@ -280,7 +281,8 @@ export class Channel extends EventEmitter {
color: p.color, color: p.color,
id: p.id, id: p.id,
x: x, x: x,
y: y y: y,
tag: usersConfig.enableTags ? p.tag : undefined
} }
] ]
); );

View File

@ -1,3 +1,4 @@
import { ChannelList } from "../../../../channel/ChannelList";
import { readUser, updateUser } from "../../../../data/user"; import { readUser, updateUser } from "../../../../data/user";
import { ServerEventListener } from "../../../../util/types"; import { ServerEventListener } from "../../../../util/types";
import { findSocketsByUserID } from "../../../Socket"; import { findSocketsByUserID } from "../../../Socket";
@ -25,5 +26,9 @@ export const tag: ServerEventListener<"tag"> = {
toUpdate.forEach(s => { toUpdate.forEach(s => {
s.setTag(msg.tag.text, msg.tag.color); s.setTag(msg.tag.text, msg.tag.color);
}); });
for (const ch of ChannelList.getList()) {
ch.emit("user data update", user);
}
} }
}; };