Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions apps/api/src/handlers/discord/pr-review-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@ export async function handleDiscordPrReviewActionCallback(input: {
if (!content) return reply(resolution);
Comment thread
roomote-community[bot] marked this conversation as resolved.
Outdated

const separator = '\n\n';
const formattedResolution = `-# ${resolution}`;
const availableContentLength =
DISCORD_MAX_MESSAGE_LENGTH - separator.length - resolution.length;
DISCORD_MAX_MESSAGE_LENGTH -
separator.length -
formattedResolution.length;
const preservedContent =
content.length <= availableContentLength
? content
: availableContentLength > 3
? `${content.slice(0, availableContentLength - 3)}...`
: content.slice(0, Math.max(availableContentLength, 0));

return reply(`${preservedContent}${separator}${resolution}`);
return reply(`${preservedContent}${separator}${formattedResolution}`);
};
const user = input.interaction.member?.user ?? input.interaction.user;
const mappedUserId = await findDiscordMappedUserId(user?.id);
Expand Down
Loading