Skip to content

fix update partenaire error#123

Merged
MaGOs92 merged 2 commits intomasterfrom
gfay_fix_update-partenaire-error
Feb 5, 2026
Merged

fix update partenaire error#123
MaGOs92 merged 2 commits intomasterfrom
gfay_fix_update-partenaire-error

Conversation

@MaGOs92
Copy link
Collaborator

@MaGOs92 MaGOs92 commented Feb 5, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issues related to updating partner reviews by adding functionality to resend verification emails for unverified reviews and improving the admin interface to properly handle email verification status.

Changes:

  • Added a new API endpoint and service function to resend verification emails for unverified reviews
  • Updated the admin UI to display email verification status and conditionally show either a "resend verification email" or "save" button
  • Modified the mapper logic to show all reviews (including unverified ones) to admin users
  • Updated Node.js version from 22 to 24 in .nvmrc to match package.json engines field

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.nvmrc Updates Node.js version from 22 to 24, aligning with package.json engines specification
server/lib/partenaire-de-la-charte/reviews/service.ts Adds resendVerificationEmail function and trailing comma fixes
server/lib/partenaire-de-la-charte/reviews/mapper.ts Changes admin view to show all reviews instead of filtering to only email-verified ones
server/lib/partenaire-de-la-charte/reviews/controller.ts Adds GET endpoint for resending verification emails with proper error handling
pages/partenaires-de-la-charte/[id].tsx Adds frontend function to resend verification emails and conditional UI rendering based on verification status
components/partenaires-de-la-charte/reviews/reviews-table.tsx Adds "Email vérifié" column header to reviews table
components/partenaires-de-la-charte/reviews/review-item.tsx Displays email verification status badge in review list
Comments suppressed due to low confidence (1)

server/lib/partenaire-de-la-charte/reviews/service.ts:79

  • The updateReview function allows setting isPublished to true even when isEmailVerified is false. While the frontend (pages/partenaires-de-la-charte/[id].tsx:250) disables the publish checkbox for unverified emails, the backend should also validate this to prevent direct API calls from bypassing this business rule. Consider adding a check: if (payload.isPublished && !review.isEmailVerified) throw new Error("Cannot publish unverified review").
export async function updateReview(reviewId: string, payload: any) {
  const review = await findOneOrFail(reviewId);
  review.isPublished = payload.isPublished;
  review.reply = payload.reply;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

);
} catch (error) {
Logger.error(
`Une erreur est survenue lors de l'envoie de la notification de review`,
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message contains a grammatical error in French. "l'envoie" should be "l'envoi". "Envoie" is a verb conjugation (he/she sends), while "envoi" is the noun (the sending/shipment).

Copilot uses AI. Check for mistakes.
@@ -76,7 +97,7 @@ export async function verifyEmail(reviewId: string, token: string) {
} catch (error) {
Logger.error(
`Une erreur est survenue lors de l'envoie de la notification de review`,
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message contains a grammatical error in French. "l'envoie" should be "l'envoi". "Envoie" is a verb conjugation (he/she sends), while "envoi" is the noun (the sending/shipment).

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +68
await fetch(
`/api/partenaires-de-la-charte/reviews/${selectedReview.id}/resend-verification-email`,
);
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fetch call does not check the response status. If the API returns an error response (4xx or 5xx), the try block will still execute and show a success toast message to the user. The response should be checked using a pattern similar to other API calls in this file, or by using the processResponse helper function pattern seen in lib/partenaires-de-la-charte.ts.

Suggested change
await fetch(
`/api/partenaires-de-la-charte/reviews/${selectedReview.id}/resend-verification-email`,
);
const response = await fetch(
`/api/partenaires-de-la-charte/reviews/${selectedReview.id}/resend-verification-email`,
);
if (!response.ok) {
let message = "";
try {
message = await response.text();
} catch {
// ignore body parsing errors and fall back to generic message
}
throw new Error(
message || `HTTP error ${response.status} while resending verification email`,
);
}

Copilot uses AI. Check for mistakes.
);
} catch (error) {
Logger.error(
`Une erreur est survenue lors de l'envoie de la notification de review`,
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message contains a grammatical error in French. "l'envoie" should be "l'envoi". "Envoie" is a verb conjugation (he/she sends), while "envoi" is the noun (the sending/shipment).

Copilot uses AI. Check for mistakes.
@MaGOs92 MaGOs92 merged commit 152bc6a into master Feb 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants