diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 20c8b4a..43d6091 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -65,7 +65,3 @@ jobs: mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }} mattermost_channel: ${{ env.MM_NOTIFICATION_CHANNEL}} deployment_url: ${{ env.DEPLOYMENT_URL }} - - name: 🎉 Celebrate Success in Mattermost - if: success() - run: | - curl -X POST -H 'Content-Type: application/json' -d '{"text": "🎉 Woohoo! Le déploiement est *green* et tout fonctionne bien! C'est l'heure de faire la fête! 🥳🍾"}' ${{ secrets.MATTERMOST_WEBHOOK_URL }} diff --git a/src/components/last-mail/lasts-mails-sent.tsx b/src/components/last-mail/lasts-mails-sent.tsx index c210201..e115e07 100644 --- a/src/components/last-mail/lasts-mails-sent.tsx +++ b/src/components/last-mail/lasts-mails-sent.tsx @@ -7,11 +7,15 @@ const LatestMails: React.FC = ({ data }) => { const [scrollIndex, setScrollIndex] = useState(0); const [isMouseOver, setIsMouseOver] = useState(false); - const filteredMails = data.data - .filter((mail) => mail.mailSent) + if (data.length === 0) { + return Aucun email trouvé.; + } + + const filteredMails = data + .filter((mail) => mail?.threads?.[0]?.responseMessage) .sort((a, b) => { - const dateA = new Date(a.mailSentDate || "").getTime(); - const dateB = new Date(b.mailSentDate || "").getTime(); + const dateA = new Date(a?.threads?.[0]?.timestamp || "").getTime(); + const dateB = new Date(b?.threads?.[0]?.timestamp || "").getTime(); return dateB - dateA; }); @@ -86,14 +90,19 @@ const LatestMails: React.FC = ({ data }) => { }} > - {mail.responseFrom} le{" "} - {new Date(mail.mailSentDate || "").toLocaleDateString()} à{" "} - {mail.name}{" "} - {mail.mailSent && ( + {mail.threads?.[0]?.team?.join(", ") || "Équipe"}{" "} + le{" "} + + {new Date( + mail.threads?.[0]?.timestamp || "" + ).toLocaleDateString()} + {" "} + à {mail.name}{" "} + {mail.threads?.[0]?.responseMessage && ( <> - {mail.mailSent.length > 100 - ? mail.mailSent.substring(0, 150) + "..." - : mail.mailSent}{" "} + {(mail.threads[0].responseMessage as string).length > 100 + ? mail.threads[0].responseMessage.substring(0, 150) + "..." + : mail.threads[0].responseMessage}{" "} = () => { }, [location.pathname]); const url = buildURL(location, sort, status, query.join(" "), page); + const { data: fetchedData, isLoading, isError, refetch, } = ContributionData(url); - const getTags = ContributionData(productionUrl); - const allTags = getTags?.data?.data?.map((tag) => tag?.tags); + const allTags = getTags?.data?.map((tag) => tag?.tags); useEffect(() => { setData(fetchedData); @@ -72,10 +72,7 @@ const ContributionPage: React.FC = () => { const meta = (fetchedData as { meta: any })?.meta; const maxPage = meta ? Math.ceil(meta?.total / 10) : 1; - const contrib: Contribute_Production[] = ( - fetchedData as { data: Contribute_Production[] } - )?.data; - + const contrib: Contribute_Production[] = fetchedData; const handleSearch = (value: string) => { const trimmedValue = value.trim(); if (trimmedValue !== "" && !query.includes(trimmedValue)) { diff --git a/src/pages/contribution-page/contribution-item.tsx b/src/pages/contribution-page/contribution-item.tsx index 3011fa0..e94b650 100644 --- a/src/pages/contribution-page/contribution-item.tsx +++ b/src/pages/contribution-page/contribution-item.tsx @@ -19,6 +19,7 @@ interface ContributionItemProps { refetch: () => void; allTags: string[]; } + const ContributionItem: React.FC = ({ data, highlightedQuery, @@ -36,6 +37,10 @@ const ContributionItem: React.FC = ({ }); }; + // Récupérer la première réponse dans les threads pour remplacer mailSent et responseFrom + const firstThread = data?.threads?.[0]; + const firstResponse = firstThread?.responses?.[0]; + return ( <> @@ -53,9 +58,9 @@ const ContributionItem: React.FC = ({ {StatusLabel({ status: data?.status })} )} - {data?.responseFrom && ( + {firstResponse?.team && ( - {`Réponse envoyée par ${data.responseFrom}`} + {`Réponse envoyée par ${firstResponse.team.join(", ")}`} )} {data?.comment && data?.team?.length > 0 && ( @@ -90,7 +95,7 @@ const ContributionItem: React.FC = ({ - {!data?.mailSent && ( + {!firstResponse && ( Aucune réponse apportée à ce message pour l'instant