From 9dc0c7537b3deb27f9192385eb008f24fd990fe1 Mon Sep 17 00:00:00 2001 From: Jon Senchyna Date: Wed, 6 Nov 2024 08:42:07 -0500 Subject: [PATCH] fix: properly use new flag (#9) --- dist/index.mjs | 8 ++++---- src/index.mjs | 4 ++-- src/workflow.mjs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/index.mjs b/dist/index.mjs index 7496d39..06898f8 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -42374,7 +42374,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen async function run() { try { const { reactionConfig, channelConfig } = (0,_workflow_mjs__WEBPACK_IMPORTED_MODULE_1__/* .getConfig */ .iE)(); - for (let { channelId, limit } of channelConfig) { + for (let { channelId, limit, disableReactionCopying } of channelConfig) { const messagesForChannel = []; for (let message of await (0,_slack_mjs__WEBPACK_IMPORTED_MODULE_2__/* .getMessages */ ._U)(channelId, limit)) { const pullRequests = (0,_github_mjs__WEBPACK_IMPORTED_MODULE_3__/* .extractPullRequests */ .Nd)(message.text); @@ -42391,7 +42391,7 @@ async function run() { } messagesForChannel.push( - await (0,_workflow_mjs__WEBPACK_IMPORTED_MODULE_1__/* .buildPrMessage */ .wB)(channelId, message, pullRequests[0], reactionConfig, channelConfig) + await (0,_workflow_mjs__WEBPACK_IMPORTED_MODULE_1__/* .buildPrMessage */ .wB)(channelId, message, pullRequests[0], reactionConfig, disableReactionCopying) ); } await (0,_slack_mjs__WEBPACK_IMPORTED_MODULE_2__/* .postOpenPrs */ .JZ)(channelId, messagesForChannel); @@ -42661,9 +42661,9 @@ function isResolved(message, reactionConfig) { * @param {ChannelConfig} channelConfig * @returns {Promise} */ -async function buildPrMessage(channelId, message, pullRequest, reactionConfig, channelConfig) { +async function buildPrMessage(channelId, message, pullRequest, reactionConfig, disableReactionCopying) { /** @type {Array} */ - const existingReactions = channelConfig.disableReactionCopying + const existingReactions = disableReactionCopying ? [] : (message.reactions ?? []) .map(reaction => reaction.name) diff --git a/src/index.mjs b/src/index.mjs index 3144958..fb9d531 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -6,7 +6,7 @@ import { extractPullRequests } from "./github.mjs" export async function run() { try { const { reactionConfig, channelConfig } = getConfig(); - for (let { channelId, limit } of channelConfig) { + for (let { channelId, limit, disableReactionCopying } of channelConfig) { const messagesForChannel = []; for (let message of await getMessages(channelId, limit)) { const pullRequests = extractPullRequests(message.text); @@ -23,7 +23,7 @@ export async function run() { } messagesForChannel.push( - await buildPrMessage(channelId, message, pullRequests[0], reactionConfig, channelConfig) + await buildPrMessage(channelId, message, pullRequests[0], reactionConfig, disableReactionCopying) ); } await postOpenPrs(channelId, messagesForChannel); diff --git a/src/workflow.mjs b/src/workflow.mjs index a56ced8..8f350b4 100644 --- a/src/workflow.mjs +++ b/src/workflow.mjs @@ -120,9 +120,9 @@ function isResolved(message, reactionConfig) { * @param {ChannelConfig} channelConfig * @returns {Promise} */ -export async function buildPrMessage(channelId, message, pullRequest, reactionConfig, channelConfig) { +export async function buildPrMessage(channelId, message, pullRequest, reactionConfig, disableReactionCopying) { /** @type {Array} */ - const existingReactions = channelConfig.disableReactionCopying + const existingReactions = disableReactionCopying ? [] : (message.reactions ?? []) .map(reaction => reaction.name)