diff --git a/Common/Server/API/SlackAPI.ts b/Common/Server/API/SlackAPI.ts index 9fc1a8d89e..30782ac4a0 100644 --- a/Common/Server/API/SlackAPI.ts +++ b/Common/Server/API/SlackAPI.ts @@ -762,8 +762,10 @@ export default class SlackAPI { if (event["type"] === "reaction_added") { logger.debug("Reaction added event received"); - // Respond immediately to Slack to prevent retry - // Process the event asynchronously + /* + * Respond immediately to Slack to prevent retry + * Process the event asynchronously + */ Response.sendTextResponse(req, res, "ok"); const reactionData = { @@ -774,8 +776,10 @@ export default class SlackAPI { messageTs: (event["item"] as JSONObject)?.["ts"] as string, }; - // Process emoji reactions for Incidents, Alerts, and Scheduled Maintenance - // Each handler will silently ignore if the channel is not linked to their resource type + /* + * Process emoji reactions for Incidents, Alerts, and Scheduled Maintenance + * Each handler will silently ignore if the channel is not linked to their resource type + */ try { await SlackIncidentActions.handleEmojiReaction(reactionData); } catch (err) { @@ -791,9 +795,13 @@ export default class SlackAPI { } try { - await SlackScheduledMaintenanceActions.handleEmojiReaction(reactionData); + await SlackScheduledMaintenanceActions.handleEmojiReaction( + reactionData, + ); } catch (err) { - logger.error("Error handling scheduled maintenance emoji reaction:"); + logger.error( + "Error handling scheduled maintenance emoji reaction:", + ); logger.error(err); } diff --git a/Common/Server/Utils/StartServer.ts b/Common/Server/Utils/StartServer.ts index 11aef0adfa..2752a4cf00 100644 --- a/Common/Server/Utils/StartServer.ts +++ b/Common/Server/Utils/StartServer.ts @@ -52,9 +52,7 @@ const jsonBodyParserMiddleware: RequestHandler = ExpressJson({ extended: true, verify: (req: ExpressRequest, _res: ExpressResponse, buf: Buffer) => { (req as OneUptimeRequest).rawBody = buf.toString(); - logger.debug( - `Raw JSON Body for signature verification captured`, - ); + logger.debug(`Raw JSON Body for signature verification captured`); }, }); // 50 MB limit. diff --git a/Common/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts b/Common/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts index 20ab0743a8..d1bf2004b4 100644 --- a/Common/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts +++ b/Common/Server/Utils/Workspace/Slack/Actions/ActionTypes.ts @@ -45,11 +45,7 @@ enum SlackActionType { } // Emoji names that trigger saving a message as a Private Note (Internal Note) -export const PrivateNoteEmojis: string[] = [ - "pushpin", - "round_pushpin", - "pin", -]; +export const PrivateNoteEmojis: string[] = ["pushpin", "round_pushpin", "pin"]; // Emoji names that trigger saving a message as a Public Note export const PublicNoteEmojis: string[] = [ diff --git a/Common/Server/Utils/Workspace/Slack/Actions/Alert.ts b/Common/Server/Utils/Workspace/Slack/Actions/Alert.ts index 246ab76f2c..cd9a0e653a 100644 --- a/Common/Server/Utils/Workspace/Slack/Actions/Alert.ts +++ b/Common/Server/Utils/Workspace/Slack/Actions/Alert.ts @@ -801,22 +801,23 @@ export default class SlackAlertActions { } // Get the project auth token using the team ID - const projectAuth = - await WorkspaceProjectAuthTokenService.findOneBy({ - query: { - workspaceProjectId: teamId, - }, - select: { - projectId: true, - authToken: true, - }, - props: { - isRoot: true, - }, - }); + const projectAuth = await WorkspaceProjectAuthTokenService.findOneBy({ + query: { + workspaceProjectId: teamId, + }, + select: { + projectId: true, + authToken: true, + }, + props: { + isRoot: true, + }, + }); if (!projectAuth || !projectAuth.projectId || !projectAuth.authToken) { - logger.debug("No project auth found for team ID. Ignoring emoji reaction."); + logger.debug( + "No project auth found for team ID. Ignoring emoji reaction.", + ); return; } @@ -849,10 +850,9 @@ export default class SlackAlertActions { const alertId: ObjectID = workspaceLog.alertId; // Get the alert number for the confirmation message - const alertNumber: number | null = - await AlertService.getAlertNumber({ - alertId: alertId, - }); + const alertNumber: number | null = await AlertService.getAlertNumber({ + alertId: alertId, + }); // Get the user ID in OneUptime based on Slack user ID const userAuth = await WorkspaceUserAuthTokenService.findOneBy({ @@ -918,8 +918,7 @@ export default class SlackAlertActions { await AlertService.getAlertLinkInDashboard(projectId, alertId) ).toString(); - const confirmationMessage: string = - `✅ Message saved as *private note* to <${alertLink}|Alert #${alertNumber}>.`; + const confirmationMessage: string = `✅ Message saved as *private note* to <${alertLink}|Alert #${alertNumber}>.`; await SlackUtil.sendMessageToThread({ authToken: authToken, diff --git a/Common/Server/Utils/Workspace/Slack/Actions/Incident.ts b/Common/Server/Utils/Workspace/Slack/Actions/Incident.ts index d44abdc094..5c57766ccf 100644 --- a/Common/Server/Utils/Workspace/Slack/Actions/Incident.ts +++ b/Common/Server/Utils/Workspace/Slack/Actions/Incident.ts @@ -1317,22 +1317,23 @@ export default class SlackIncidentActions { } // Get the project auth token using the team ID - const projectAuth = - await WorkspaceProjectAuthTokenService.findOneBy({ - query: { - workspaceProjectId: teamId, - }, - select: { - projectId: true, - authToken: true, - }, - props: { - isRoot: true, - }, - }); + const projectAuth = await WorkspaceProjectAuthTokenService.findOneBy({ + query: { + workspaceProjectId: teamId, + }, + select: { + projectId: true, + authToken: true, + }, + props: { + isRoot: true, + }, + }); if (!projectAuth || !projectAuth.projectId || !projectAuth.authToken) { - logger.debug("No project auth found for team ID. Ignoring emoji reaction."); + logger.debug( + "No project auth found for team ID. Ignoring emoji reaction.", + ); return; } diff --git a/Common/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts b/Common/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts index a7a6f7a0e3..8af3e94848 100644 --- a/Common/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +++ b/Common/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts @@ -1125,7 +1125,9 @@ export default class SlackScheduledMaintenanceActions { channelId: string; messageTs: string; }): Promise { - logger.debug("Handling emoji reaction for Scheduled Maintenance with data:"); + logger.debug( + "Handling emoji reaction for Scheduled Maintenance with data:", + ); logger.debug(data); const { teamId, reaction, userId, channelId, messageTs } = data; @@ -1142,22 +1144,23 @@ export default class SlackScheduledMaintenanceActions { } // Get the project auth token using the team ID - const projectAuth = - await WorkspaceProjectAuthTokenService.findOneBy({ - query: { - workspaceProjectId: teamId, - }, - select: { - projectId: true, - authToken: true, - }, - props: { - isRoot: true, - }, - }); + const projectAuth = await WorkspaceProjectAuthTokenService.findOneBy({ + query: { + workspaceProjectId: teamId, + }, + select: { + projectId: true, + authToken: true, + }, + props: { + isRoot: true, + }, + }); if (!projectAuth || !projectAuth.projectId || !projectAuth.authToken) { - logger.debug("No project auth found for team ID. Ignoring emoji reaction."); + logger.debug( + "No project auth found for team ID. Ignoring emoji reaction.", + ); return; } @@ -1187,7 +1190,8 @@ export default class SlackScheduledMaintenanceActions { return; } - const scheduledMaintenanceId: ObjectID = workspaceLog.scheduledMaintenanceId; + const scheduledMaintenanceId: ObjectID = + workspaceLog.scheduledMaintenanceId; // Get the scheduled maintenance number for the confirmation message const scheduledMaintenanceNumber: number | null = @@ -1271,7 +1275,10 @@ export default class SlackScheduledMaintenanceActions { // Send confirmation message as a reply to the original message thread try { const scheduledMaintenanceLink: string = ( - await ScheduledMaintenanceService.getScheduledMaintenanceLinkInDashboard(projectId, scheduledMaintenanceId) + await ScheduledMaintenanceService.getScheduledMaintenanceLinkInDashboard( + projectId, + scheduledMaintenanceId, + ) ).toString(); const confirmationMessage: string =