Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette committed Sep 21, 2023
1 parent ffd160c commit 9fc891c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
1 change: 1 addition & 0 deletions docs/src/modules/components/AppLayoutDocsFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
22 changes: 3 additions & 19 deletions netlify/functions/feedback-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -184,6 +169,7 @@ exports.handler = async (event, context, callback) => {
currentLocationURL,
commmentSectionURL: inCommmentSectionURL,
commmentSectionTitle,
githubRepo,
} = data;

const isDesignFeedback = inCommmentSectionURL.includes('#new-docs-api-feedback');
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 9fc891c

Please sign in to comment.