From 9fc891c870c740d3655c19c93944c8c1b50a5544 Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 21 Sep 2023 10:18:25 +0200 Subject: [PATCH] feedback --- .../modules/components/AppLayoutDocsFooter.js | 1 + netlify/functions/feedback-management.js | 22 +++---------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/docs/src/modules/components/AppLayoutDocsFooter.js b/docs/src/modules/components/AppLayoutDocsFooter.js index 7ea0fb57e47532..a1395172f70dfd 100644 --- a/docs/src/modules/components/AppLayoutDocsFooter.js +++ b/docs/src/modules/components/AppLayoutDocsFooter.js @@ -109,6 +109,7 @@ async function postFeedbackOnSlack(data) { currentLocationURL: window.location.href, commmentSectionURL: `${window.location.origin}${window.location.pathname}#${commentedSection.hash}`, commmentSectionTitle: commentedSection.text, + githubRepo: process.env.SOURCE_CODE_REPO ?? 'https://github.com/mui/material-ui', }; if (!comment || comment.length < 10) { return 'ignored'; diff --git a/netlify/functions/feedback-management.js b/netlify/functions/feedback-management.js index 724badb5cab515..1aea5eb0742a58 100644 --- a/netlify/functions/feedback-management.js +++ b/netlify/functions/feedback-management.js @@ -27,21 +27,6 @@ const getSlackChannelId = (url, specialCases) => { return CORE_FEEBACKS_CHANNEL_ID; }; -const getGitHubRepo = (url, specialCases) => { - const { isDesignFeedback } = specialCases; - - if (isDesignFeedback) { - return 'material-ui'; - } - if (url.includes('/x/')) { - return 'mui-x'; - } - if (url.includes('/toolpad/')) { - return 'mui-toolpad'; - } - return 'material-ui'; -}; - const spreadSheetsIds = { forLater: '1NAUTsIcReVylWPby5K0omXWZpgjd9bjxE8V2J-dwPyc', }; @@ -89,7 +74,7 @@ function getQuoteAndLinks(message) { app.action('delete_action', async ({ ack, body, client, logger }) => { try { await ack(); - console.log(JSON.stringify({ body })); + const { user: { username }, channel: { id: channelId }, @@ -184,6 +169,7 @@ exports.handler = async (event, context, callback) => { currentLocationURL, commmentSectionURL: inCommmentSectionURL, commmentSectionTitle, + githubRepo, } = data; const isDesignFeedback = inCommmentSectionURL.includes('#new-docs-api-feedback'); @@ -229,9 +215,7 @@ from ${commmentSectionURL} text: 'Create issue', emoji: true, }, - url: `https://github.com/mui/${getGitHubRepo(currentLocationURL, { - isDesignFeedback, - })}/issues/new?${githubNewIssueParams}`, + url: `${githubRepo}/issues/new?${githubNewIssueParams}`, }, { type: 'button',