Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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.

20 changes: 17 additions & 3 deletions apps/api/src/handlers/slack/events/reactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ async function markWorkItemLaunched(params: {

const REMOVED_SLACK_ACCOUNT_LAUNCH_FAILURE =
'I could not start this because your linked Roomote account was removed. Ask an admin to restore your access, then reconnect Slack.';
const UNLINKED_SLACK_ACCOUNT_LAUNCH_FAILURE =
'Link your Roomote account to start tasks from Slack.';

async function launchTaskSuggestionTaskFromReaction({
teamId,
Expand Down Expand Up @@ -403,6 +405,20 @@ async function launchTaskSuggestionTaskFromReaction({
return true;
}

if (!reactingUserMapping.activeMapping) {
await postSuggestionLaunchFailureMessage({
slack,
channelId,
title: `${buildSuggestionBadgePrefix({
category: workItem.category,
priority: workItem.priority,
})}${workItem.title}`,
brief: suggestionBrief,
reason: UNLINKED_SLACK_ACCOUNT_LAUNCH_FAILURE,
});
return true;
}

const claimedWorkItem = await claimWorkItem(db, { id: workItemId });

if (!claimedWorkItem) {
Expand Down Expand Up @@ -496,9 +512,7 @@ async function launchTaskSuggestionTaskFromReaction({
initiator: {
kind: 'user',
externalId: reactionEvent.user,
...(reactingUserMapping.activeMapping?.userId
? { matchedUserId: reactingUserMapping.activeMapping.userId }
: {}),
matchedUserId: reactingUserMapping.activeMapping.userId,
},
trigger: 'manual',
channel: channelId,
Expand Down
53 changes: 53 additions & 0 deletions apps/api/src/handlers/teams/__tests__/index.test.ts

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

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

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

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

13 changes: 13 additions & 0 deletions packages/db/src/lib/__tests__/work-item-claims.test.ts

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

Loading