From b04c8db982a8102ce227e150670de990a47f0fc1 Mon Sep 17 00:00:00 2001 From: Niklas P Date: Tue, 21 Jan 2025 12:06:14 +0100 Subject: [PATCH] fix a bug with wrong parent ids --- data/post.ts | 5 +---- .../reaction-handlers/add/PaymentReactionAddHandler.ts | 7 ------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/data/post.ts b/data/post.ts index a48bcfb..831f96b 100644 --- a/data/post.ts +++ b/data/post.ts @@ -161,10 +161,7 @@ export async function findOrCreateThreadPost(attributes: { }): Promise { const { message, content, url } = attributes; - const parentId = message.channel.isThread() - ? message.channel.parent!.id - : undefined; - console.log("findOrCreateThreadPost parentId", parentId); + const parentId = message.channel.isThread() ? message.channelId : undefined; const threadPost = findOrCreatePost({ message, diff --git a/handlers/reaction-handlers/add/PaymentReactionAddHandler.ts b/handlers/reaction-handlers/add/PaymentReactionAddHandler.ts index 86b8a44..bc92623 100644 --- a/handlers/reaction-handlers/add/PaymentReactionAddHandler.ts +++ b/handlers/reaction-handlers/add/PaymentReactionAddHandler.ts @@ -237,8 +237,6 @@ export class OddJobPaymentReactionAddHandler extends BasePaymentReactionAddHandl reaction: MessageReaction, user: DiscordUser, ) { - console.log("Handling payment reaction for oddjob"); - const { paymentAmount, paymentUnit, fundingSource } = this.paymentRule!; const dbReaction = await upsertEntityReaction( @@ -297,10 +295,7 @@ export class ThreadPaymentReactionAddHandler extends PostPaymentReactionAddHandl reaction: MessageReaction, user: DiscordUser, ): Promise { - console.log("Initializing payment reaction for a thread"); await super.initialize(reaction, user); - - // If the message is a thread, set the parentId this.parentId = reaction.message.channelId; } @@ -313,8 +308,6 @@ export class ThreadPaymentReactionAddHandler extends PostPaymentReactionAddHandl reaction: MessageReaction, user: DiscordUser, ) { - console.log("Handling payment reaction for a thread"); - // 1. if the thread is not in the database, create it on payment if (!this.dbContent) { this.dbContent = await findOrCreateThreadPost({