1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

fix events: only send on id

This commit is contained in:
Flam3rboy 2021-08-11 19:43:14 +02:00
parent a09303d294
commit 69eddc6bb5
6 changed files with 1 additions and 15 deletions

View File

@ -30,7 +30,7 @@ router.delete("/", async (req: Request, res: Response) => {
// TODO: Dm channel "close" not delete
const data = toObject(channel);
await emitEvent({ event: "CHANNEL_DELETE", data, guild_id: channel?.guild_id, channel_id } as ChannelDeleteEvent);
await emitEvent({ event: "CHANNEL_DELETE", data, channel_id } as ChannelDeleteEvent);
await ChannelModel.deleteOne({ id: channel_id });
@ -51,7 +51,6 @@ router.patch("/", check(ChannelModifySchema), async (req: Request, res: Response
await emitEvent({
event: "CHANNEL_UPDATE",
data,
guild_id: channel.guild_id,
channel_id
} as ChannelUpdateEvent);

View File

@ -35,7 +35,6 @@ router.patch("/", check(MessageCreateSchema), async (req: Request, res: Response
await emitEvent({
event: "MESSAGE_UPDATE",
channel_id,
guild_id: message.guild_id,
data: { ...toObject(message), nonce: undefined }
} as MessageUpdateEvent);
@ -60,7 +59,6 @@ router.delete("/", async (req: Request, res: Response) => {
await emitEvent({
event: "MESSAGE_DELETE",
channel_id,
guild_id: channel.guild_id,
data: {
id: message_id,
channel_id,

View File

@ -48,7 +48,6 @@ router.delete("/", async (req: Request, res: Response) => {
await emitEvent({
event: "MESSAGE_REACTION_REMOVE_ALL",
channel_id,
guild_id: channel.guild_id,
data: {
channel_id,
message_id,
@ -79,7 +78,6 @@ router.delete("/:emoji", async (req: Request, res: Response) => {
await emitEvent({
event: "MESSAGE_REACTION_REMOVE_EMOJI",
channel_id,
guild_id: channel.guild_id,
data: {
channel_id,
message_id,
@ -140,7 +138,6 @@ router.put("/:emoji/:user_id", async (req: Request, res: Response) => {
await emitEvent({
event: "MESSAGE_REACTION_ADD",
channel_id,
guild_id: channel.guild_id,
data: {
user_id: req.user_id,
channel_id,
@ -179,7 +176,6 @@ router.delete("/:emoji/:user_id", async (req: Request, res: Response) => {
await emitEvent({
event: "MESSAGE_REACTION_REMOVE",
channel_id,
guild_id: channel.guild_id,
data: {
user_id: req.user_id,
channel_id,

View File

@ -44,7 +44,6 @@ router.put("/:overwrite_id", check({ allow: String, deny: String, type: Number,
await emitEvent({
event: "CHANNEL_UPDATE",
channel_id,
guild_id: channel.guild_id,
data: channel
} as ChannelUpdateEvent);
@ -64,7 +63,6 @@ router.delete("/:overwrite_id", async (req: Request, res: Response) => {
await emitEvent({
event: "CHANNEL_UPDATE",
channel_id,
guild_id: channel.guild_id,
data: channel
} as ChannelUpdateEvent);

View File

@ -32,14 +32,12 @@ router.put("/:message_id", async (req: Request, res: Response) => {
await emitEvent({
event: "MESSAGE_UPDATE",
channel_id,
guild_id: channel.guild_id,
data: message
} as MessageUpdateEvent);
await emitEvent({
event: "CHANNEL_PINS_UPDATE",
channel_id,
guild_id: channel.guild_id,
data: {
channel_id,
guild_id: channel.guild_id,
@ -64,14 +62,12 @@ router.delete("/:message_id", async (req: Request, res: Response) => {
await emitEvent({
event: "MESSAGE_UPDATE",
channel_id,
guild_id: channel.guild_id,
data: message
} as MessageUpdateEvent);
await emitEvent({
event: "CHANNEL_PINS_UPDATE",
channel_id,
guild_id: channel.guild_id,
data: {
channel_id,
guild_id: channel.guild_id,

View File

@ -16,7 +16,6 @@ router.post("/", async (req: Request, res: Response) => {
await emitEvent({
event: "TYPING_START",
channel_id: channel_id,
guild_id: channel.guild_id,
data: {
// this is the paylod
member: toObject(member),