-
-
Notifications
You must be signed in to change notification settings - Fork 105
fix: AI message dismiss button #1403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix: AI message dismiss button #1403
Conversation
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.
| .build(); | ||
| private final ComponentIdInteractor componentIdInteractor = | ||
| new ComponentIdInteractor(getInteractionType(), getName()); | ||
| private static final int FIRST_MESSAGE_ONLY = 1; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 -> { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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