Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OSDEV-1532] Fix date filter on the Moderation Queue page #469

Merged
merged 3 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/release/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
### Bugfix
* [OSDEV-1492](https://opensupplyhub.atlassian.net/browse/OSDEV-1492) - Fixed an issue where invalid manually entered dates were not validated on the UI, resulting in API errors with message “The request query is invalid.” on `Moderation Queue` page. Invalid dates are now trimmed and properly handled.
* [OSDEV-1493](https://opensupplyhub.atlassian.net/browse/OSDEV-1493) - Fixed an issue where the backend sorts countries not by `name` but by their `alpha-2 codes` in `GET /api/v1/moderation-events/` endpoint.
* [OSDEV-1532](https://opensupplyhub.atlassian.net/browse/OSDEV-1532) - Fixed the date range picker on the `Moderation Queue` page. A Data Moderator can change the Before date even if an Error message is displayed.

### What's new
* [OSDEV-1376](https://opensupplyhub.atlassian.net/browse/OSDEV-1376) - Updated automated emails for closure reports (report_result) to remove the term "Rejected" for an improved user experience. Added link to Closure Policy and instructions for submitting a Reopening Report to make the process easier to understand for users.
Expand Down
12 changes: 7 additions & 5 deletions src/react/src/components/Dashboard/DashboardModerationQueue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const DashboardModerationQueue = ({

useEffect(() => {
/*
Fetch data if prev filters were not empty but
Fetch data if prev filters were not empty but
become empty after user click on select field.
This will resolve conflict of when we want to fetch data
when filters are removing in UI at the moment
Expand Down Expand Up @@ -130,20 +130,21 @@ const DashboardModerationQueue = ({
}, [dataSources, moderationStatuses, countries]);

const handleAfterDateChange = date => {
setAfterDateError(false);
setBeforeDateError(false);
if (!isValidDate(date)) {
dispatch(updateAfterDate(null));
setErrorDateText(DATE_FORMAT_ERROR);
setAfterDateError(true);
return;
}
if (!isValidDateRange(beforeDate, date)) {
dispatch(updateAfterDate(null));
dispatch(updateAfterDate(date));
setErrorDateText(DATE_RANGE_ERROR);
setAfterDateError(true);
return;
}

setAfterDateError(false);
dispatch(updateAfterDate(date));
dispatch(clearModerationEvents());
dispatch(
Expand All @@ -157,20 +158,21 @@ const DashboardModerationQueue = ({
};

const handleBeforeDateChange = date => {
setAfterDateError(false);
setBeforeDateError(false);
if (!isValidDate(date)) {
dispatch(updateBeforeDate(null));
setErrorDateText(DATE_FORMAT_ERROR);
setBeforeDateError(true);
return;
}
if (!isValidDateRange(date, afterDate)) {
dispatch(updateBeforeDate(null));
dispatch(updateBeforeDate(date));
setErrorDateText(DATE_RANGE_ERROR);
setBeforeDateError(true);
return;
}

setBeforeDateError(false);
dispatch(updateBeforeDate(date));
dispatch(clearModerationEvents());
dispatch(
Expand Down
Loading