Only offer reply and reactions on bot messages
The user's own messages no longer get the reply and react row. A bot's reaction to one still shows, read-only, and react-message refuses a reaction on the user's own message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -10,8 +10,8 @@ import isReadOnlyUser from "@/src/utils/rbac/is-read-only-user";
|
||||
import safeErrorMessage from "@/src/utils/safe-error-message";
|
||||
|
||||
/**
|
||||
* Adds or takes back one of the fixed emoji reactions on a message in the
|
||||
* session user's own conversation, and pushes the message's fresh
|
||||
* Adds or takes back one of the fixed emoji reactions on a bot message in
|
||||
* the session user's own conversation, and pushes the message's fresh
|
||||
* reactions to their other open tabs.
|
||||
*/
|
||||
export const handler: BunextAPIRouteHandler<APIResponseObject> = async ({ req, body }) => {
|
||||
@@ -36,6 +36,11 @@ export const handler: BunextAPIRouteHandler<APIResponseObject> = async ({ req, b
|
||||
});
|
||||
|
||||
const message = await grabUserBotMessage({ user_id: user.id, message_id });
|
||||
|
||||
if (message.author == "user") {
|
||||
throw new AppError(`You can only react to the bot's messages.`);
|
||||
}
|
||||
|
||||
const reactions = await toggleMessageReaction({
|
||||
message_id: Number(message.id),
|
||||
user_id: user.id,
|
||||
|
||||
Reference in New Issue
Block a user