Skip to content

Conversation

@ankitsmt211
Copy link
Member

when message that created thread was deleted,
retrieveStartMessage() threw an error UNKNOWN_MESSAGE leading to non-functional dismiss button.

this adds a handler, specifically for parent message deleted error by using getIterableHistoryInstead.

resolves #1400

when message that created thread was deleted,
retrieveStartMessage() threw an error UNKNOWN_MESSAGE
leading to non-functional dismiss button.

this adds a handler, specifically for parent message
deleted error by using getIterableHistoryInstead.
@ankitsmt211 ankitsmt211 self-assigned this Jan 30, 2026
@ankitsmt211 ankitsmt211 requested a review from a team as a code owner January 30, 2026 19:12
@ankitsmt211 ankitsmt211 added bug Something isn't working priority: low labels Jan 30, 2026
.build();
private final ComponentIdInteractor componentIdInteractor =
new ComponentIdInteractor(getInteractionType(), getName());
private static final int FIRST_MESSAGE_ONLY = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming is a bit off and perhaps something you would give to a boolean. Instead, let's rename this to NUMBER_OF_MESSAGES + some additional context.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to function's scope and renamed it for clarity

ThreadChannel channel = event.getChannel().asThreadChannel();
Member interactionUser = Objects.requireNonNull(event.getMember());

Consumer<Throwable> handleParentMessageDeleted = error -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can extract this as it's own function as opposed to defining it like this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

.build();
private final ComponentIdInteractor componentIdInteractor =
new ComponentIdInteractor(getInteractionType(), getName());
private static final int FIRST_MESSAGE_ONLY = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this constant cant be understood without context. i would move it down as local var next to where its used so the context is available. and then the name can also be more like that, bc the context is available

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
});
} else {
log.error("Failed to retrieve start message: ", error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add context to the log, so its easier to work with when we see it in the monitoring. sth like

Trying to dismiss automatic help message for thread (id: ...) but cannot find original message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* move AI dismiss fallback consumer to a seperate function for clarity
* move variable FIRST_MESSAGE_ONLY to function scope as noOfMessage for
  clarity
* improve error log message for clarity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dismiss AI message button doesn't work

3 participants