[Bug] [OSDEV-2107] Search button redirects user to Stripe Checkout page instead of search result#691
Conversation
…to purchase downloads before using their free allowance (#683) **[Release Bug] [OSDEV-1879](https://opensupplyhub.atlassian.net/browse/OSDEV-1879) Handled case where an existing user tries to purchase downloads before using their free allowance** - Fixed issue where existing users who hadn’t used their free downloads were unable to purchase additional downloads. [OSDEV-1879]: https://opensupplyhub.atlassian.net/browse/OSDEV-1879?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[OSDEV-1868](https://opensupplyhub.atlassian.net/browse/OSDEV-1868) Updated tooltip texts. Updated text for `out of downloads` and `limit exceeded by results` cases. Passed `facilitiesCount` to the DownloadFacilitiesButton component, added to propTypes, fixed tests. [OSDEV-1868]: https://opensupplyhub.atlassian.net/browse/OSDEV-1868?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: Inessa Druzhkova <[email protected]>
… packages instead of 5,000 record (#688) **[Release Bug] [OSDEV-1879](https://opensupplyhub.atlassian.net/browse/OSDEV-1879) Purchase additional 10,000 record download packages instead of 5,000 record** - Increased the number of purchased records from 5,000 to 10,000. [OSDEV-1879]: https://opensupplyhub.atlassian.net/browse/OSDEV-1879?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
…ing the browser’s back button caused the search button to repeatedly redirect to Stripe Checkout.
React App | Jest test suite - Code coverage reportTotal: 34.88%Your code coverage diff: 0.02% ▴ ✅ All code changes are covered |
📝 WalkthroughWalkthroughThe changes increase the download limit for the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DownloadFacilitiesButton
participant ReduxStore
participant StripeCheckout
participant FacilitiesDownloadService
User->>DownloadFacilitiesButton: Click "Download"
DownloadFacilitiesButton->>FacilitiesDownloadService: Get download limit (with facilitiesCount)
FacilitiesDownloadService-->>DownloadFacilitiesButton: Return allowed records
DownloadFacilitiesButton->>ReduxStore: Dispatch fetchDownloadLimitCheckoutUrl
ReduxStore-->>DownloadFacilitiesButton: Provide checkoutUrl
DownloadFacilitiesButton->>StripeCheckout: Redirect to checkoutUrl
DownloadFacilitiesButton->>ReduxStore: Dispatch clearDownloadLimitCheckoutUrl
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
doc/release/RELEASE-NOTES.md (2)
17-18: Polish the wording for precision & grammarThe current sentence is hard to parse (“allowed to downloads unlimited amount …”). Consider re-phrasing:
-* 0174_create_private_instance_switch - This migration introduces a new `PRIVATE_INSTANCE` feature flag that allowed to downloads unlimited amount of records but only 10,000 records or less per action. +* 0174_create_private_instance_switch – Introduces the `PRIVATE_INSTANCE` feature flag, which permits an unlimited overall number of downloads while capping each individual download action at 10,000 records.
51-55: Fix typos and clarify button-text changeSmall copy issues:
- “Embeded” → “Embedded”.
- The phrase “from Upgrade to Download to Purchase More Downloads” is unclear.
Suggested patch:
-* Updated implementation for private_instance flag to allow 10k records instead of 5k records per download. -* Added logic to skip download limit check for Embeded Map requests. -* Updated the UI part of Embeded Map to properly allow and show 10k records limitation per download. -* Update button text from Upgrade to Download to Purchase More Downloads. +* Updated `private_instance` flag implementation to allow 10 k records (was 5 k) per download. +* Added logic to skip the download-limit check for Embedded Map requests. +* Updated the Embedded Map UI to reflect the 10 k-record limit per download. +* Changed button copy from “Upgrade to Download” to “Purchase More Downloads”. * Redirected the user back to the last OS Hub URL after completing Stripe Checkout.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
doc/release/RELEASE-NOTES.md(2 hunks)src/django/api/constants.py(1 hunks)src/django/api/views/stripe/download_locations_checkout_session_view.py(2 hunks)src/react/src/__tests__/components/DownloadFacilitiesButton.test.js(4 hunks)src/react/src/actions/downloadLimit.js(1 hunks)src/react/src/components/DownloadFacilitiesButton.jsx(6 hunks)src/react/src/components/FilterSidebarFacilitiesTab.jsx(1 hunks)src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx(1 hunks)src/react/src/reducers/DownloadLimitReducer.js(2 hunks)src/react/src/util/getTooltipForFacilitiesDownload.jsx(1 hunks)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/react/src/util/propTypes.js:63-66
Timestamp: 2025-06-17T10:49:15.274Z
Learning: Anonymous users in the Open Supply Hub application receive a default `allowed_records_number` of 5000 to enable them to see and interact with the download button, which then prompts them to authenticate. This UX pattern shows capability before requiring authentication rather than hiding features from anonymous users.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#581
File: src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx:232-233
Timestamp: 2025-04-14T13:22:28.661Z
Learning: In the Open Supply Hub application, the user object in Redux store is initialized with USER_DEFAULT_STATE which includes allowed_records_number: FACILITIES_DOWNLOAD_LIMIT (1000). This means that even before a real user is loaded or for anonymous users, the user.allowed_records_number will have a valid default value, making null checks unnecessary when accessing this property.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/facilities_download_view_set.py:115-119
Timestamp: 2025-06-17T10:55:08.363Z
Learning: In the FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py, the existing validation checks do not prevent paid_download_records from going negative. The validation only checks if the user has zero total quota (free + paid == 0) on the first page, and if the total query results exceed the global limit of 5000, but does not validate the user's remaining quota against the actual records_to_subtract value which is calculated after pagination.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/models/facility_download_limit_manager.py:23-26
Timestamp: 2025-06-18T12:47:04.059Z
Learning: In the facility download limit system, when paid download records expire and are reset to zero, the purchase_date field should be preserved to maintain historical purchase records for audit trail and analytics purposes.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/models/facility_download_limit.py:64-73
Timestamp: 2025-06-18T12:46:27.549Z
Learning: The validation checks in FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py are insufficient to prevent register_download from receiving more records than the user's available quota. The method only validates against zero total quota on first page and global limits, but doesn't validate records_returned against remaining user quota before calling register_download.
src/django/api/constants.py (3)
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/facilities_download_view_set.py:115-119
Timestamp: 2025-06-17T10:55:08.363Z
Learning: In the FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py, the existing validation checks do not prevent paid_download_records from going negative. The validation only checks if the user has zero total quota (free + paid == 0) on the first page, and if the total query results exceed the global limit of 5000, but does not validate the user's remaining quota against the actual records_to_subtract value which is calculated after pagination.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/react/src/util/propTypes.js:63-66
Timestamp: 2025-06-17T10:49:15.274Z
Learning: Anonymous users in the Open Supply Hub application receive a default `allowed_records_number` of 5000 to enable them to see and interact with the download button, which then prompts them to authenticate. This UX pattern shows capability before requiring authentication rather than hiding features from anonymous users.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/models/facility_download_limit.py:64-73
Timestamp: 2025-06-18T12:46:27.549Z
Learning: The validation checks in FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py are insufficient to prevent register_download from receiving more records than the user's available quota. The method only validates against zero total quota on first page and global limits, but doesn't validate records_returned against remaining user quota before calling register_download.
src/react/src/components/FilterSidebarFacilitiesTab.jsx (7)
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/Contribute/ProductionLocationDialog.jsx:33-181
Timestamp: 2024-12-10T07:09:35.641Z
Learning: In the `ProductionLocationDialog.jsx` component, hardcoded facility data is acceptable for now as per the project's requirements.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#415
File: src/react/src/components/Button.jsx:43-43
Timestamp: 2024-11-22T12:22:59.701Z
Learning: In the Open Supply Hub codebase, the Button component in `src/react/src/components/Button.jsx` is designed to have an optional `onClick` prop to accommodate different cases.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:216-219
Timestamp: 2024-11-28T10:01:06.144Z
Learning: In the `DashboardModerationQueueListTable` component in `src/react/src/components/Dashboard/DashboardModerationQueueListTable.jsx`, the `index` and `maxIndex` props are used and should not be considered unused.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#415
File: src/react/src/components/ContributeForm.jsx:175-206
Timestamp: 2024-11-20T23:08:05.475Z
Learning: In the `ContributeForm.jsx` React component, it's acceptable to include an empty `onClick={() => {}}` handler on a disabled `<Button>` to prevent console warnings.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:246-254
Timestamp: 2024-11-28T09:15:37.831Z
Learning: In `src/react/src/components/Dashboard/DashboardModerationQueue.jsx`, within the `mapStateToProps` function, `dashboardModerationQueue` and `filters` are guaranteed to be defined, so providing default values or using optional chaining to access their properties is unnecessary.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#437
File: src/react/src/components/Filters/StyledSelect.jsx:31-39
Timestamp: 2024-12-05T10:43:59.922Z
Learning: In the `StyledSelect` component (`src/react/src/components/Filters/StyledSelect.jsx`), the `label` prop is optional. The `InputLabel` should be conditionally rendered only when a label is provided to prevent unnecessary DOM elements, extra padding, and browser console warnings.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/ProductionLocationDialog.jsx:255-257
Timestamp: 2024-12-03T06:52:22.170Z
Learning: In `src/react/src/components/ProductionLocationDialog.jsx`, the 'Submit another Location' button's `onClick` handler logs to the console as the endpoint is not yet implemented on the frontend.
src/django/api/views/stripe/download_locations_checkout_session_view.py (4)
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/facilities_download_view_set.py:115-119
Timestamp: 2025-06-17T10:55:08.363Z
Learning: In the FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py, the existing validation checks do not prevent paid_download_records from going negative. The validation only checks if the user has zero total quota (free + paid == 0) on the first page, and if the total query results exceed the global limit of 5000, but does not validate the user's remaining quota against the actual records_to_subtract value which is calculated after pagination.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/django/api/models/facility_download_limit.py:64-73
Timestamp: 2025-06-18T12:46:27.549Z
Learning: The validation checks in FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py are insufficient to prevent register_download from receiving more records than the user's available quota. The method only validates against zero total quota on first page and global limits, but doesn't validate records_returned against remaining user quota before calling register_download.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#431
File: src/django/api/serializers/v1/opensearch_common_validators/countries_validator.py:23-24
Timestamp: 2024-11-28T11:29:28.139Z
Learning: The files `src/django/api/tests/test_facility_claim_view_set.py`, `src/django/api/views/facility/facilities_view_set.py`, and `src/django/api/facility_actions/processing_facility_api.py` are not part of the V1 codebase in the Open Supply Hub project.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#431
File: src/django/api/tests/test_production_locations_view_set.py:45-46
Timestamp: 2024-11-28T11:40:54.281Z
Learning: Files `src/django/api/views/facility/facilities_view_set.py`, `src/django/api/facility_actions/processing_facility_api.py`, and `src/django/api/tests/test_facility_claim_view_set.py` are not part of v1 and should not be considered in v1-related code reviews.
src/react/src/actions/downloadLimit.js (1)
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:112-124
Timestamp: 2024-11-28T10:02:44.696Z
Learning: In `src/react/src/components/Dashboard/DashboardModerationQueue.jsx`, within the `handleAfterDateChange` function, dispatch actions should be called even when `date` is null or undefined.
src/react/src/reducers/DownloadLimitReducer.js (1)
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:112-124
Timestamp: 2024-11-28T10:02:44.696Z
Learning: In `src/react/src/components/Dashboard/DashboardModerationQueue.jsx`, within the `handleAfterDateChange` function, dispatch actions should be called even when `date` is null or undefined.
src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx (4)
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/Contribute/ProductionLocationDialog.jsx:33-181
Timestamp: 2024-12-10T07:09:35.641Z
Learning: In the `ProductionLocationDialog.jsx` component, hardcoded facility data is acceptable for now as per the project's requirements.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:216-219
Timestamp: 2024-11-28T10:01:06.144Z
Learning: In the `DashboardModerationQueueListTable` component in `src/react/src/components/Dashboard/DashboardModerationQueueListTable.jsx`, the `index` and `maxIndex` props are used and should not be considered unused.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#415
File: src/react/src/components/Button.jsx:43-43
Timestamp: 2024-11-22T12:22:59.701Z
Learning: In the Open Supply Hub codebase, the Button component in `src/react/src/components/Button.jsx` is designed to have an optional `onClick` prop to accommodate different cases.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/ProductionLocationDialog.jsx:255-257
Timestamp: 2024-12-03T06:52:22.170Z
Learning: In `src/react/src/components/ProductionLocationDialog.jsx`, the 'Submit another Location' button's `onClick` handler logs to the console as the endpoint is not yet implemented on the frontend.
src/react/src/__tests__/components/DownloadFacilitiesButton.test.js (12)
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/DialogTooltip.jsx:0-0
Timestamp: 2024-12-03T10:29:02.409Z
Learning: In the `DialogTooltip` component (`src/react/src/components/DialogTooltip.jsx`), there are existing tooltip tests that cover common cases, and further detailed tests are not necessary.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#470
File: src/react/src/__tests__/components/ProductionLocationDialog.test.js:0-0
Timestamp: 2025-01-27T07:20:43.334Z
Learning: In the Open Supply Hub project, buttons wrapped by the `DialogTooltip` component control their disabled state through CSS pointer-events rather than the HTML disabled attribute, requiring tests to check `getComputedStyle().pointerEvents` instead of using `toBeDisabled()`.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#470
File: src/react/src/__tests__/components/ProductionLocationDialog.test.js:122-122
Timestamp: 2025-01-27T07:58:22.674Z
Learning: When testing button states in components wrapped with DialogTooltip/Tooltip, use getComputedStyle().pointerEvents checks instead of direct button attribute assertions, as the wrapping prevents direct access to the button's attributes.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/Contribute/ProductionLocationDialog.jsx:33-181
Timestamp: 2024-12-10T07:09:35.641Z
Learning: In the `ProductionLocationDialog.jsx` component, hardcoded facility data is acceptable for now as per the project's requirements.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#483
File: src/react/src/__tests__/components/SearchByNameAndAddressSuccessResult.test.js:0-0
Timestamp: 2025-01-17T16:12:18.285Z
Learning: In the SearchByNameAndAddressSuccessResult component's tests, attempting to test internal navigation logic through mocking useHistory is not feasible, and button presence/click events should be covered in the main rendering test case.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#415
File: src/react/src/components/Button.jsx:43-43
Timestamp: 2024-11-22T12:22:59.701Z
Learning: In the Open Supply Hub codebase, the Button component in `src/react/src/components/Button.jsx` is designed to have an optional `onClick` prop to accommodate different cases.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/ProductionLocationDialog.jsx:255-257
Timestamp: 2024-12-03T06:52:22.170Z
Learning: In `src/react/src/components/ProductionLocationDialog.jsx`, the 'Submit another Location' button's `onClick` handler logs to the console as the endpoint is not yet implemented on the frontend.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:216-219
Timestamp: 2024-11-28T10:01:06.144Z
Learning: In the `DashboardModerationQueueListTable` component in `src/react/src/components/Dashboard/DashboardModerationQueueListTable.jsx`, the `index` and `maxIndex` props are used and should not be considered unused.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#581
File: src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx:232-233
Timestamp: 2025-04-14T13:22:28.661Z
Learning: In the Open Supply Hub application, the user object in Redux store is initialized with USER_DEFAULT_STATE which includes allowed_records_number: FACILITIES_DOWNLOAD_LIMIT (1000). This means that even before a real user is loaded or for anonymous users, the user.allowed_records_number will have a valid default value, making null checks unnecessary when accessing this property.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#642
File: src/react/src/util/propTypes.js:63-66
Timestamp: 2025-06-17T10:49:15.274Z
Learning: Anonymous users in the Open Supply Hub application receive a default `allowed_records_number` of 5000 to enable them to see and interact with the download button, which then prompts them to authenticate. This UX pattern shows capability before requiring authentication rather than hiding features from anonymous users.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#483
File: src/react/src/__tests__/components/SearchByNameAndAddressSuccessResult.test.js:110-118
Timestamp: 2025-01-17T15:04:49.076Z
Learning: In the SearchByNameAndAddressSuccessResult component, the Select functionality is implemented internally within the component rather than being passed as props, making it unsuitable for direct function mocking in tests.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#470
File: src/react/src/__tests__/components/ProductionLocationDialog.test.js:66-105
Timestamp: 2025-01-27T07:57:17.370Z
Learning: The ProductionLocationDialog component does not receive error props directly, as errors are not passed down explicitly to this component.
src/react/src/components/DownloadFacilitiesButton.jsx (10)
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#415
File: src/react/src/components/Button.jsx:43-43
Timestamp: 2024-11-22T12:22:59.701Z
Learning: In the Open Supply Hub codebase, the Button component in `src/react/src/components/Button.jsx` is designed to have an optional `onClick` prop to accommodate different cases.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/Contribute/ProductionLocationDialog.jsx:33-181
Timestamp: 2024-12-10T07:09:35.641Z
Learning: In the `ProductionLocationDialog.jsx` component, hardcoded facility data is acceptable for now as per the project's requirements.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:216-219
Timestamp: 2024-11-28T10:01:06.144Z
Learning: In the `DashboardModerationQueueListTable` component in `src/react/src/components/Dashboard/DashboardModerationQueueListTable.jsx`, the `index` and `maxIndex` props are used and should not be considered unused.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/ProductionLocationDialog.jsx:255-257
Timestamp: 2024-12-03T06:52:22.170Z
Learning: In `src/react/src/components/ProductionLocationDialog.jsx`, the 'Submit another Location' button's `onClick` handler logs to the console as the endpoint is not yet implemented on the frontend.
Learnt from: Innavin369
PR: opensupplyhub/open-supply-hub#415
File: src/react/src/components/ContributeForm.jsx:175-206
Timestamp: 2024-11-20T23:08:05.475Z
Learning: In the `ContributeForm.jsx` React component, it's acceptable to include an empty `onClick={() => {}}` handler on a disabled `<Button>` to prevent console warnings.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:112-124
Timestamp: 2024-11-28T10:02:44.696Z
Learning: In `src/react/src/components/Dashboard/DashboardModerationQueue.jsx`, within the `handleAfterDateChange` function, dispatch actions should be called even when `date` is null or undefined.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#470
File: src/react/src/__tests__/components/ProductionLocationDialog.test.js:122-122
Timestamp: 2025-01-27T07:58:22.674Z
Learning: When testing button states in components wrapped with DialogTooltip/Tooltip, use getComputedStyle().pointerEvents checks instead of direct button attribute assertions, as the wrapping prevents direct access to the button's attributes.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#470
File: src/react/src/__tests__/components/ProductionLocationDialog.test.js:0-0
Timestamp: 2025-01-27T07:20:43.334Z
Learning: In the Open Supply Hub project, buttons wrapped by the `DialogTooltip` component control their disabled state through CSS pointer-events rather than the HTML disabled attribute, requiring tests to check `getComputedStyle().pointerEvents` instead of using `toBeDisabled()`.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#470
File: src/react/src/components/Contribute/ProductionLocationInfo.jsx:229-243
Timestamp: 2025-01-23T10:19:59.642Z
Learning: In React useEffect hooks that perform navigation, adding router-related dependencies (history, location) to the dependency array can cause unwanted re-renders and side effects. For navigation effects triggered by data changes, include only the data dependencies.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#429
File: src/react/src/components/Dashboard/DashboardModerationQueue.jsx:246-254
Timestamp: 2024-11-28T09:15:37.831Z
Learning: In `src/react/src/components/Dashboard/DashboardModerationQueue.jsx`, within the `mapStateToProps` function, `dashboardModerationQueue` and `filters` are guaranteed to be defined, so providing default values or using optional chaining to access their properties is unnecessary.
src/react/src/util/getTooltipForFacilitiesDownload.jsx (3)
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/DialogTooltip.jsx:0-0
Timestamp: 2024-12-03T10:29:02.409Z
Learning: In the `DialogTooltip` component (`src/react/src/components/DialogTooltip.jsx`), there are existing tooltip tests that cover common cases, and further detailed tests are not necessary.
Learnt from: roman-stolar
PR: opensupplyhub/open-supply-hub#448
File: src/react/src/util/util.js:1317-1317
Timestamp: 2024-12-10T15:07:54.819Z
Learning: Changes to date handling functions like `formatDate` in `src/react/src/util/util.js` should be made carefully, considering that different parts of the codebase may intentionally use local time instead of UTC, and broad changes to `moment()` usage may not be appropriate without context.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#436
File: src/react/src/components/Contribute/ProductionLocationDialog.jsx:33-181
Timestamp: 2024-12-10T07:09:35.641Z
Learning: In the `ProductionLocationDialog.jsx` component, hardcoded facility data is acceptable for now as per the project's requirements.
doc/release/RELEASE-NOTES.md (7)
undefined
<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #420
File: doc/release/RELEASE-NOTES.md:38-38
Timestamp: 2024-11-26T04:59:12.296Z
Learning: For endpoints that haven't been released to end users, it's acceptable to document API changes under the 'Bugfix' section in the release notes.
</retrieved_learning>
<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #420
File: doc/release/RELEASE-NOTES.md:47-54
Timestamp: 2024-11-28T06:36:47.122Z
Learning: API changes and migration details are documented in a separate repository with API specifications, rather than in the release notes.
</retrieved_learning>
<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #420
File: doc/release/RELEASE-NOTES.md:47-54
Timestamp: 2024-11-28T06:36:47.122Z
Learning: Endpoints that have not been enabled to end users do not require migration documentation or old vs new format examples in the release notes.
</retrieved_learning>
<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #420
File: doc/release/RELEASE-NOTES.md:37-37
Timestamp: 2024-11-25T13:28:23.090Z
Learning: When modifying unreleased API endpoints, such as refactoring the search_after parameter into search_after_value and search_after_id in the OpenSearch implementation, it's acceptable to leave the "What's New" section empty since the changes haven't been released to end users.
</retrieved_learning>
<retrieved_learning>
Learnt from: Innavin369
PR: #642
File: src/django/api/facilities_download_view_set.py:115-119
Timestamp: 2025-06-17T10:55:08.363Z
Learning: In the FacilitiesDownloadViewSet.list method in src/django/api/facilities_download_view_set.py, the existing validation checks do not prevent paid_download_records from going negative. The validation only checks if the user has zero total quota (free + paid == 0) on the first page, and if the total query results exceed the global limit of 5000, but does not validate the user's remaining quota against the actual records_to_subtract value which is calculated after pagination.
</retrieved_learning>
<retrieved_learning>
Learnt from: VadimKovalenkoSNF
PR: #641
File: doc/release/RELEASE-NOTES.md:6-35
Timestamp: 2025-06-02T13:24:57.659Z
Learning: The Open Supply Hub team keeps placeholders in release notes until code freeze, then fills in the actual content once all changes are finalized for the release.
</retrieved_learning>
<retrieved_learning>
Learnt from: Innavin369
PR: #642
File: src/react/src/util/propTypes.js:63-66
Timestamp: 2025-06-17T10:49:15.274Z
Learning: Anonymous users in the Open Supply Hub application receive a default allowed_records_number of 5000 to enable them to see and interact with the download button, which then prompts them to authenticate. This UX pattern shows capability before requiring authentication rather than hiding features from anonymous users.
</retrieved_learning>
🧬 Code Graph Analysis (6)
src/react/src/components/FilterSidebarFacilitiesTab.jsx (1)
src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx (1)
facilitiesCount(211-211)
src/django/api/views/stripe/download_locations_checkout_session_view.py (1)
src/django/api/services/facilities_download_service.py (2)
FacilitiesDownloadService(18-98)get_download_limit(46-51)
src/react/src/reducers/DownloadLimitReducer.js (1)
src/react/src/actions/downloadLimit.js (2)
clearDownloadLimitCheckoutUrl(17-19)clearDownloadLimitCheckoutUrl(17-19)
src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx (1)
src/react/src/components/FilterSidebarFacilitiesTab.jsx (1)
facilitiesCount(325-325)
src/react/src/components/DownloadFacilitiesButton.jsx (3)
src/react/src/actions/downloadLimit.js (2)
clearDownloadLimitCheckoutUrl(17-19)clearDownloadLimitCheckoutUrl(17-19)src/react/src/components/FilterSidebarFacilitiesTab.jsx (1)
facilitiesCount(325-325)src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx (1)
facilitiesCount(211-211)
src/react/src/util/getTooltipForFacilitiesDownload.jsx (3)
src/react/src/util/constants.jsx (2)
FREE_FACILITIES_DOWNLOAD_LIMIT(10-10)FREE_FACILITIES_DOWNLOAD_LIMIT(10-10)src/react/src/components/FilterSidebarFacilitiesTab.jsx (1)
facilitiesCount(325-325)src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx (1)
facilitiesCount(211-211)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
- GitHub Check: run-eslint-linter-and-prettier-formatter
- GitHub Check: run-dd-code-quality
- GitHub Check: run-flake8-linter
- GitHub Check: run-contricleaner-code-quality
- GitHub Check: get-base-branch-dd-cov
- GitHub Check: run-integration-test-code-quality
- GitHub Check: get-base-branch-contricleaner-cov
- GitHub Check: get-base-branch-countries-cov
- GitHub Check: get-base-branch-fe-cov
- GitHub Check: run-countries-code-quality
- GitHub Check: run-django-code-quality
- GitHub Check: run-fe-code-quality
- GitHub Check: get-base-branch-django-cov
- GitHub Check: run-django-code-quality
- GitHub Check: get-base-branch-django-cov
- GitHub Check: run-integration-test-code-quality
🔇 Additional comments (17)
src/django/api/constants.py (1)
286-286: LGTM! Download limit increase implemented correctly.The constant has been updated from 5,000 to 10,000 records, which aligns with the feature to increase download limits for paid users.
src/react/src/actions/downloadLimit.js (1)
17-19: LGTM! New action creator properly implemented.The
clearDownloadLimitCheckoutUrlaction follows the established pattern and will help manage the checkout URL state lifecycle, likely addressing the redirect bug mentioned in the PR objectives.src/react/src/components/FilterSidebarFacilitiesTab.jsx (1)
370-370: LGTM! Prop addition enhances download button functionality.The
facilitiesCountprop is properly extracted from the data object (line 325) and passed to enable more specific tooltip messaging about download limits.src/react/src/components/NonVectorTileFilterSidebarFacilitiesTab.jsx (1)
245-245: LGTM! Consistent prop addition across components.The
facilitiesCountprop is properly extracted from the data object (line 211) and passed to enhance the download button functionality, maintaining consistency with the similar change inFilterSidebarFacilitiesTab.jsx.src/react/src/reducers/DownloadLimitReducer.js (2)
8-8: LGTM! Import properly added.The
clearDownloadLimitCheckoutUrlaction is correctly imported to support the new reducer handler.
43-48: LGTM! Reducer handler properly implemented.The new handler correctly resets the
checkoutUrlfield to its initial value (null) using the immutability-helper pattern, which will help clear the checkout URL state after redirects.src/react/src/__tests__/components/DownloadFacilitiesButton.test.js (3)
33-33: Good addition of required prop to test defaults.Adding
facilitiesCount: 10to the default props ensures all tests have the required prop and prevents potential test failures.
177-177: Tooltip text correctly updated for download limit messaging.The updated tooltip text properly reflects the new functionality that includes specific facility counts in the download limit message.
195-195: Test scenario properly validates facility count integration.The test correctly verifies that when
facilitiesCount(2000) exceedsuserAllowedRecords(1000), the tooltip displays both values to help users understand the limitation.Also applies to: 208-208
src/react/src/components/DownloadFacilitiesButton.jsx (5)
14-14: Proper import of new action creator.The import of
clearDownloadLimitCheckoutUrlis correctly added to support the checkout URL clearing functionality.
74-74: New prop properly integrated into component parameters.The
facilitiesCountprop is correctly added to the component parameters and will be used for enhanced tooltip messaging.
93-93: Good addition of checkout URL clearing to prevent redirect loops.Dispatching
clearDownloadLimitCheckoutUrl()after navigation prevents the bug mentioned in the PR objectives where users would be repeatedly redirected to the Stripe checkout page.
134-134: Proper integration of facilitiesCount into tooltip logic.The
facilitiesCountprop is correctly passed togetTooltipForFacilitiesDownloadand added to the dependency array, ensuring the tooltip updates when the facility count changes.Also applies to: 143-143
215-215: Correct prop type definition for required facilitiesCount.The
facilitiesCountprop is properly typed as a required number, which aligns with its usage in the component for tooltip calculations.src/react/src/util/getTooltipForFacilitiesDownload.jsx (3)
19-20: LGTM! Enhanced tooltip specificity.The inclusion of
${userAllowedRecords}makes the tooltip more informative by showing the exact number of available downloads.
21-22: LGTM! Consistent use of download limit constant.The tooltip correctly references the
FREE_FACILITIES_DOWNLOAD_LIMITconstant for the annual download limit.
23-25: Improved user feedback with specific numbers.The tooltip now provides clear information about both the number of facilities being downloaded and the user's remaining quota, which significantly improves the user experience.
|
Dedupe Hub App | Unittest test suite - Code coverage reportTotal: 55.73%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Countries App | Unittest test suite - Code coverage reportTotal: 100%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Contricleaner App | Unittest test suite - Code coverage reportTotal: 98.75%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Django App | Unittest test suite - Code coverage reportTotal: 81.11%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |



[Bug] OSDEV-2107 Search button redirects user to Stripe Checkout page instead of search result