Skip to content

Commit

Permalink
fix a bug with wrong parent ids
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasp committed Jan 21, 2025
1 parent 3c03bb6 commit b04c8db
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
5 changes: 1 addition & 4 deletions data/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ export async function findOrCreateThreadPost(attributes: {
}): Promise<PostWithEarnings> {
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,
Expand Down
7 changes: 0 additions & 7 deletions handlers/reaction-handlers/add/PaymentReactionAddHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -297,10 +295,7 @@ export class ThreadPaymentReactionAddHandler extends PostPaymentReactionAddHandl
reaction: MessageReaction,
user: DiscordUser,
): Promise<void> {
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;
}

Expand All @@ -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({
Expand Down

0 comments on commit b04c8db

Please sign in to comment.