review viewable after 72 hours instead of 10 minutes if only one side submits a review
This commit is contained in:
@@ -35,7 +35,7 @@ const addDisplayStatusToArray = (rentals) => {
|
||||
// Helper function to check and update review visibility
|
||||
const checkAndUpdateReviewVisibility = async (rental) => {
|
||||
const now = new Date();
|
||||
const tenMinutesInMs = 10 * 60 * 1000; // 10 minutes
|
||||
const seventyTwoHoursInMs = 72 * 60 * 60 * 1000; // 72 hours
|
||||
|
||||
let needsUpdate = false;
|
||||
let updates = {};
|
||||
@@ -48,20 +48,20 @@ const checkAndUpdateReviewVisibility = async (rental) => {
|
||||
needsUpdate = true;
|
||||
}
|
||||
} else {
|
||||
// Check item review visibility (10-minute rule)
|
||||
// Check item review visibility (72-hour rule)
|
||||
if (rental.itemReviewSubmittedAt && !rental.itemReviewVisible) {
|
||||
const timeSinceSubmission = now - new Date(rental.itemReviewSubmittedAt);
|
||||
if (timeSinceSubmission >= tenMinutesInMs) {
|
||||
if (timeSinceSubmission >= seventyTwoHoursInMs) {
|
||||
updates.itemReviewVisible = true;
|
||||
needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check renter review visibility (10-minute rule)
|
||||
// Check renter review visibility (72-hour rule)
|
||||
if (rental.renterReviewSubmittedAt && !rental.renterReviewVisible) {
|
||||
const timeSinceSubmission =
|
||||
now - new Date(rental.renterReviewSubmittedAt);
|
||||
if (timeSinceSubmission >= tenMinutesInMs) {
|
||||
if (timeSinceSubmission >= seventyTwoHoursInMs) {
|
||||
updates.renterReviewVisible = true;
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ const ReviewItemModal: React.FC<ReviewItemModalProps> = ({
|
||||
setSuccessMessage("Review published successfully!");
|
||||
} else {
|
||||
setSuccessMessage(
|
||||
"Review submitted! It will be published when both parties have reviewed or after 10 minutes."
|
||||
"Review submitted! It will be published when both parties have reviewed or after 72 hours."
|
||||
);
|
||||
}
|
||||
setShowSuccessModal(true);
|
||||
|
||||
@@ -47,7 +47,7 @@ const ReviewRenterModal: React.FC<ReviewRenterModalProps> = ({
|
||||
setSuccessMessage("Review published successfully!");
|
||||
} else {
|
||||
setSuccessMessage(
|
||||
"Review submitted! It will be published when both parties have reviewed or after 10 minutes."
|
||||
"Review submitted! It will be published when both parties have reviewed or after 72 hours."
|
||||
);
|
||||
}
|
||||
setShowSuccessModal(true);
|
||||
|
||||
Reference in New Issue
Block a user