From c94069bb3743c3bb233fe015c5d4159d19878dfe Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Sat, 3 Aug 2024 07:13:04 -0400 Subject: [PATCH] Implement tags into user data propogation event on channels --- src/channel/Channel.ts | 4 +++- src/ws/events/admin/handlers/tag.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/channel/Channel.ts b/src/channel/Channel.ts index acf2624..ae0c486 100644 --- a/src/channel/Channel.ts +++ b/src/channel/Channel.ts @@ -9,6 +9,7 @@ import { IChannelInfo, Notification, UserFlags, + Tag, } from "../util/types"; import type { Socket } from "../ws/Socket"; import { validateChannelSettings } from "./settings"; @@ -280,7 +281,8 @@ export class Channel extends EventEmitter { color: p.color, id: p.id, x: x, - y: y + y: y, + tag: usersConfig.enableTags ? p.tag : undefined } ] ); diff --git a/src/ws/events/admin/handlers/tag.ts b/src/ws/events/admin/handlers/tag.ts index 9bfdcf7..02706a3 100644 --- a/src/ws/events/admin/handlers/tag.ts +++ b/src/ws/events/admin/handlers/tag.ts @@ -1,3 +1,4 @@ +import { ChannelList } from "../../../../channel/ChannelList"; import { readUser, updateUser } from "../../../../data/user"; import { ServerEventListener } from "../../../../util/types"; import { findSocketsByUserID } from "../../../Socket"; @@ -25,5 +26,9 @@ export const tag: ServerEventListener<"tag"> = { toUpdate.forEach(s => { s.setTag(msg.tag.text, msg.tag.color); }); + + for (const ch of ChannelList.getList()) { + ch.emit("user data update", user); + } } };