Skip to content

Commit

Permalink
fix checks (#2726)
Browse files Browse the repository at this point in the history
  • Loading branch information
spolu authored Nov 30, 2023
1 parent 813785d commit 8c05d8e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
8 changes: 8 additions & 0 deletions connectors/src/connectors/slack/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,13 @@ export async function syncNonThreaded(
}
hasMore = c.has_more;
} while (hasMore);

if (messages.length === 0) {
// no non threaded messages, so we're done
return;
}
messages.reverse();

const text = await formatMessagesForUpsert(
channelId,
messages,
Expand Down Expand Up @@ -571,6 +573,11 @@ export async function syncThread(
const botUserId = await getBotUserIdMemoized(slackClient);
allMessages = allMessages.filter((m) => m.user !== botUserId);

if (allMessages.length === 0) {
// No threaded messages, so we're done.
return;
}

const text = await formatMessagesForUpsert(
channelId,
allMessages,
Expand Down Expand Up @@ -603,6 +610,7 @@ export async function syncThread(
messageTs: threadTs,
documentId: documentId,
});

await upsertToDatasource({
dataSourceConfig,
documentId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,14 @@ async function handler(
sourceUrl = standardizedSourceUrl;
}

const section = bodyValidation.right.text
? {
prefix: null,
content: bodyValidation.right.text,
sections: [],
}
: bodyValidation.right.section || null;
const section =
typeof bodyValidation.right.text === "string"
? {
prefix: null,
content: bodyValidation.right.text,
sections: [],
}
: bodyValidation.right.section || null;

if (!section) {
return apiError(req, res, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ async function handler(
sourceUrl = standardizedSourceUrl;
}

const section = bodyValidation.right.text
? {
prefix: null,
content: bodyValidation.right.text,
sections: [],
}
: bodyValidation.right.section || null;
const section =
typeof bodyValidation.right.text === "string"
? {
prefix: null,
content: bodyValidation.right.text,
sections: [],
}
: bodyValidation.right.section || null;

if (!section) {
return apiError(req, res, {
Expand Down

0 comments on commit 8c05d8e

Please sign in to comment.