mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 22:09:12 +02:00
[SILO-192] fix: slack shortcut key (#3087)
* fix: slack shortcut key * fix: passing user id to connection details
This commit is contained in:
@@ -462,7 +462,7 @@ export default class SlackController {
|
||||
);
|
||||
}
|
||||
|
||||
if (payload.event === "issue" && !payload.activity.field.includes("_id")) {
|
||||
if (payload.event === "issue" && payload.activity.field && !payload.activity.field.includes("_id")) {
|
||||
const payload = req.body as PlaneWebhookPayloadBase<ExIssue>;
|
||||
|
||||
const id = payload.data.id;
|
||||
|
||||
@@ -92,7 +92,7 @@ export type SlackPrivateMetadata<T extends keyof EntityPayloadMapping = keyof En
|
||||
|
||||
export enum E_MESSAGE_ACTION_TYPES {
|
||||
LINK_WORK_ITEM = "link_work_item",
|
||||
CREATE_NEW_WORK_ITEM = "create_new_issue",
|
||||
CREATE_NEW_WORK_ITEM = "issue_shortcut",
|
||||
DISCONNECT_WORK_ITEM = "disconnect_work_item",
|
||||
ISSUE_WEBLINK_SUBMISSION = "issue_weblink_submission",
|
||||
ISSUE_COMMENT_SUBMISSION = "issue_comment_submission",
|
||||
|
||||
@@ -8,7 +8,9 @@ import { createProjectSelectionModal } from "../../views";
|
||||
import { getAccountConnectionBlocks } from "../../views/account-connection";
|
||||
|
||||
export const handleCommand = async (data: TSlackCommandPayload) => {
|
||||
const details = await getConnectionDetails(data.team_id);
|
||||
const details = await getConnectionDetails(data.team_id, {
|
||||
id: data.user_id,
|
||||
});
|
||||
if (!details) {
|
||||
logger.info(`[SLACK] No connection details found for team ${data.team_id}`);
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,9 @@ export const handleSlackEvent = async (data: SlackEventPayload) => {
|
||||
break;
|
||||
}
|
||||
} catch (error: any) {
|
||||
const details = await getConnectionDetails(data.team_id);
|
||||
const details = await getConnectionDetails(data.team_id, {
|
||||
id: data.event.user,
|
||||
});
|
||||
if (!details) {
|
||||
logger.info(`[SLACK] No connection details found for team ${data.team_id}`);
|
||||
return;
|
||||
@@ -48,7 +50,9 @@ export const handleMessageEvent = async (data: SlackEventPayload) => {
|
||||
if (data.event.type === "message") {
|
||||
if (!data.event.thread_ts) return;
|
||||
|
||||
const details = await getConnectionDetails(data.team_id);
|
||||
const details = await getConnectionDetails(data.team_id, {
|
||||
id: data.event.user,
|
||||
});
|
||||
if (!details) {
|
||||
logger.info(`[SLACK] No connection details found for team ${data.team_id}`);
|
||||
return;
|
||||
@@ -100,7 +104,9 @@ export const handleMessageEvent = async (data: SlackEventPayload) => {
|
||||
|
||||
export const handleLinkSharedEvent = async (data: SlackEventPayload) => {
|
||||
if (data.event.type === "link_shared") {
|
||||
const details = await getConnectionDetails(data.team_id);
|
||||
const details = await getConnectionDetails(data.team_id, {
|
||||
id: data.event.user,
|
||||
});
|
||||
if (!details) {
|
||||
logger.info(`[SLACK] No connection details found for team ${data.team_id}`);
|
||||
return;
|
||||
|
||||
@@ -13,11 +13,14 @@ import { ENTITIES } from "../../helpers/constants";
|
||||
const apiClient = getAPIClient();
|
||||
|
||||
export const handleMessageAction = async (data: TMessageActionPayload) => {
|
||||
|
||||
|
||||
if (!data.callback_id) {
|
||||
logger.info(`[SLACK] No callback id found for message action ${data.type}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (data.callback_id) {
|
||||
case E_MESSAGE_ACTION_TYPES.LINK_WORK_ITEM:
|
||||
await handleLinkWorkItem(data);
|
||||
@@ -39,7 +42,9 @@ const handleLinkWorkItem = async (data: TMessageActionPayload) => {
|
||||
already linked to another thread and to disconnect it first
|
||||
*/
|
||||
|
||||
const details = await getConnectionDetails(data.team.id);
|
||||
const details = await getConnectionDetails(data.team.id, {
|
||||
id: data.user.id,
|
||||
});
|
||||
if (!details) {
|
||||
logger.info(`[SLACK] No connection details found for team ${data.team.id}`);
|
||||
return;
|
||||
@@ -112,7 +117,9 @@ const handleLinkWorkItem = async (data: TMessageActionPayload) => {
|
||||
|
||||
const handleCreateNewWorkItem = async (data: TMessageActionPayload) => {
|
||||
// Get the workspace connection for the associated team
|
||||
const details = await getConnectionDetails(data.team.id);
|
||||
const details = await getConnectionDetails(data.team.id, {
|
||||
id: data.user.id,
|
||||
});
|
||||
if (!details) {
|
||||
logger.info(`[SLACK] No connection details found for team ${data.team.id}`);
|
||||
return;
|
||||
|
||||
@@ -16,7 +16,9 @@ import { credentials } from "amqplib";
|
||||
const apiClient = getAPIClient();
|
||||
|
||||
export const handleViewSubmission = async (data: TViewSubmissionPayload) => {
|
||||
const details = await getConnectionDetails(data.team.id);
|
||||
const details = await getConnectionDetails(data.team.id, {
|
||||
id: data.user.id,
|
||||
});
|
||||
if (!details) {
|
||||
logger.info(`[SLACK] No connection details found for team ${data.team.id}`);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user