Skip to content

[OSDEV-1117] Contribution record integration#454

Merged
VadimKovalenkoSNF merged 60 commits intomainfrom
OSDEV-1117-contribution-record-integration
Jan 9, 2025
Merged

[OSDEV-1117] Contribution record integration#454
VadimKovalenkoSNF merged 60 commits intomainfrom
OSDEV-1117-contribution-record-integration

Conversation

@VadimKovalenkoSNF
Copy link
Contributor

@VadimKovalenkoSNF VadimKovalenkoSNF commented Dec 12, 2024

Fix OSDEV-1117

  1. Connect GET api/v1/moderation-events/{moderation_id}/.
  2. Connect GET api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address} to get potential matches using OpenSearch engine.
  3. Connect PATCH /v1/moderation-events/{moderation_id}/ (using for Reject button).
  4. Connect POST /v1/moderation-events/{moderation_id}/production-locations/ (using for Create New Location button).
  5. Connect PATCH /v1/moderation-events/{moderation_id}/production-locations/{os_id}/ (using for Confirm potential match button).
  6. UI improvements: added toast component on moderation event update and backdrop to prevent accident clicks on other buttons while updation process.
  7. Apply Django Signal for moderation-events index.
  8. Update FE tests.
  9. Add integration tests.

@barecheck
Copy link

barecheck bot commented Dec 12, 2024

Dedupe Hub App | Unittest test suite - Code coverage report

Total: 56.14%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Dec 12, 2024

Countries App | Unittest test suite - Code coverage report

Total: 100%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Dec 12, 2024

Contricleaner App | Unittest test suite - Code coverage report

Total: 98.91%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (7)
doc/release/RELEASE-NOTES.md (2)

34-34: Add a more descriptive summary for the OSDEV-1117 feature.

The entry "Implemented integration of Contribution Record Page" is too brief and doesn't provide enough context about the feature's purpose or impact.

Consider expanding it to something like:

-* [OSDEV-1117](https://opensupplyhub.atlassian.net/browse/OSDEV-1117) - Implemented integration of Contribution Record Page.
+* [OSDEV-1117](https://opensupplyhub.atlassian.net/browse/OSDEV-1117) - Implemented integration of Contribution Record Page to streamline the moderation process by providing a centralized view for reviewing and managing contribution records.

Line range hint 36-40: Ensure post-deployment commands are properly formatted and include all necessary steps.

The release instructions section should be clear and structured for deployment teams.

Consider reformatting for better readability:

-### Release instructions:
-* Ensure that the following commands are included in the `post_deployment` command:
-    * `migrate`
-    * `reindex_database`
-* Run `[Release] Deploy` pipeline for the target environment with the flag `Clear the custom OpenSearch indexes and templates` set to true - to refresh the index mappings for the `moderation-events` index after disabling dynamic mapping for the new fields that don't have an explicit mapping defined. The `production-locations` will also be affected since it will clean all of our custom indexes and templates within the OpenSearch cluster
+### Release instructions:
+1. Ensure that the following commands are included in the `post_deployment` command:
+   * `migrate` - Apply database migrations
+   * `reindex_database` - Rebuild search indexes
+
+2. Run `[Release] Deploy` pipeline:
+   * Set flag `Clear the custom OpenSearch indexes and templates` to true
+   * This will:
+     - Refresh index mappings for `moderation-events` index
+     - Clean all custom indexes and templates in OpenSearch cluster
+     - Affect `production-locations` index
🧰 Tools
🪛 Markdownlint (0.37.0)

36-36: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

src/tests/v1/moderator/test_moderation_event_record.py (5)

4-4: Remove unused import

The datetime import is not used in the code.

-from datetime import datetime
🧰 Tools
🪛 Ruff (0.8.2)

4-4: datetime.datetime imported but unused

Remove unused import: datetime.datetime

(F401)


11-11: Consider documenting the REINDEX_INTERVAL constant

Add a comment explaining why this specific interval was chosen to help future maintainers understand the reasoning.

+# Time in seconds to wait for OpenSearch indexing. This value is based on the system's
+# predefined 1-minute reindexing time plus a 20-second buffer.
REINDEX_INTERVAL = 80

14-41: Add type hints for better code maintainability

Consider adding type hints to improve code readability and IDE support.

class ModerationEventRecordTest(BaseAPITest):
-    def setUp(self):
+    def setUp(self) -> None:
         super().setUp()
-        self.moderation_event_id = None
+        self.moderation_event_id: str | None = None
-        self.name = 'Changzhou Hualida Garments Group Co.'
+        self.name: str = 'Changzhou Hualida Garments Group Co.'
-        self.address = 'Lot 303 No.1108 Zhongwu High Road Changzhou Jiangsu China - China'
+        self.address: str = 'Lot 303 No.1108 Zhongwu High Road Changzhou Jiangsu China - China'
-        self.county_alpha_2_code = 'CN'
+        self.county_alpha_2_code: str = 'CN'

-        self.new_moderation_event = {
+        self.new_moderation_event: dict = {

43-51: Add docstrings to test methods

Consider adding docstrings to describe the purpose and workflow of each test method. This will make it easier for other developers to understand the test scenarios.

Example for the first test method:

 def test_moderation_events_default_output(self):
+    """
+    Test that the moderation events endpoint returns paginated results
+    with the default page size of 10 items.
+    """
     response = requests.get(

Also applies to: 52-61, 62-85, 86-132, 133-146, 147-163, 164-177


164-177: Improve rate limiting test reliability

The current implementation might be flaky as it depends on a fixed number of requests. Consider:

  1. Adding a timeout to prevent the test from running too long
  2. Using exponential backoff between requests to reduce server load
 def test_moderation_events_rate_limiting(self):
+    """
+    Test that the API enforces rate limiting after multiple rapid requests.
+    The test uses exponential backoff and timeout to prevent excessive load.
+    """
     self.create_moderation_event()
-    for _ in range(500):
+    
+    MAX_ATTEMPTS = 100
+    INITIAL_DELAY = 0.1
+    MAX_TIMEOUT = 30
+    start_time = time.time()
+    attempt = 0
+    
+    while time.time() - start_time < MAX_TIMEOUT and attempt < MAX_ATTEMPTS:
         response = requests.get(
             f"{self.root_url}/api/v1/moderation-events/{self.moderation_event_id}",
             headers=self.basic_headers,
         )
         if response.status_code == HTTP_429_TOO_MANY_REQUEST:
             self.assertEqual(response.status_code, HTTP_429_TOO_MANY_REQUEST, "Expected 429 for rate-limited requests.")
             result = response.json()
             self.assertIn('Request was throttled', result['detail'], "Error message should be returned when rate-limited.")
             break
+        attempt += 1
+        time.sleep(min(INITIAL_DELAY * (2 ** attempt), 1.0))
     else:
-        self.skipTest("Rate limit was not reached; adjust loop count or rate-limit policy if needed.")
+        self.skipTest(f"Rate limit not reached after {attempt} attempts in {time.time() - start_time:.2f} seconds")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e65e21 and 6a23c67.

📒 Files selected for processing (4)
  • doc/release/RELEASE-NOTES.md (1 hunks)
  • src/react/src/__tests__/components/DashboardModerationQueueListTable.test.js (6 hunks)
  • src/react/src/components/Dashboard/DashboardModerationQueue.jsx (14 hunks)
  • src/tests/v1/moderator/test_moderation_event_record.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/react/src/tests/components/DashboardModerationQueueListTable.test.js
  • src/react/src/components/Dashboard/DashboardModerationQueue.jsx
🧰 Additional context used
📓 Learnings (1)
src/tests/v1/moderator/test_moderation_event_record.py (4)
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#454
File: src/tests/v1/moderator/test_moderation_event_record.py:53-62
Timestamp: 2024-12-26T09:07:37.571Z
Learning: No dynamic creation test is needed in test_moderation_event_record.py because src/tests/v1/test_moderation_events.py assumes responsibility for creating moderation events, and the test relies on a persistent mock environment with a hardcoded moderation ID.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/tests/v1/test_moderation_events.py:218-226
Timestamp: 2024-11-13T07:11:08.097Z
Learning: In integration tests, the `ModerationEvents` API is not accessible because it runs in a separate container.
Learnt from: VadimKovalenkoSNF
PR: opensupplyhub/open-supply-hub#391
File: src/tests/v1/test_moderation_events.py:16-17
Timestamp: 2024-11-13T07:11:20.995Z
Learning: In integration tests like `src/tests/v1/test_moderation_events.py` that run separately from the Django container, we can't import Django models like `ModerationEvent`.
Learnt from: mazursasha1990
PR: opensupplyhub/open-supply-hub#438
File: src/django/api/tests/test_moderation_events_add_production_location.py:21-65
Timestamp: 2024-12-12T14:59:19.694Z
Learning: In `src/django/api/tests/test_moderation_events_add_production_location.py`, the tests have been refactored, and the use of `POST` methods is intentional. Future suggestions to change HTTP methods in these tests may not be necessary.
🪛 Ruff (0.8.2)
src/tests/v1/moderator/test_moderation_event_record.py

4-4: datetime.datetime imported but unused

Remove unused import: datetime.datetime

(F401)

🔇 Additional comments (1)
doc/release/RELEASE-NOTES.md (1)

Line range hint 1-1000: LGTM! Document structure follows the template.

The release notes document follows the RELEASE-NOTES-TEMPLATE.md format and includes all necessary sections:

  • Introduction with product name and release date
  • Database changes (migrations and scheme changes)
  • Code/API changes
  • Architecture/Environment changes
  • Bugfixes
  • New features
  • Release instructions
🧰 Tools
🪛 Markdownlint (0.37.0)

36-36: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
doc/release/RELEASE-NOTES.md (1)

37-37: 🛠️ Refactor suggestion

Please provide more detailed information about the Contribution Record Page integration.

The current entry lacks sufficient detail about the implemented functionality. Consider adding:

  • The purpose and benefits of the integration
  • Key features or capabilities added
  • Any important user workflow changes

Note: This comment reinforces a similar request made in a previous review.

🧹 Nitpick comments (3)
doc/release/RELEASE-NOTES.md (1)

Line range hint 47-50: Enhance release instructions with execution order and verification steps.

Consider expanding the release instructions to include:

  1. The specific order of command execution
  2. Any prerequisites or dependencies
  3. Verification steps to confirm successful deployment

Example format:

### Release instructions:
1. Ensure the following commands are executed in order during post_deployment:
   * `migrate` - Apply database migrations
   * `reindex_database` - Rebuild search indexes
2. Verify deployment:
   * Check migration status
   * Confirm indexes are updated
🧰 Tools
🪛 Markdownlint (0.37.0)

40-40: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


39-39: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


40-40: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)

src/react/src/util/styles.js (2)

802-805: Consider using theme spacing for consistent padding.

The button styles use hardcoded padding values. Consider using theme spacing units for better consistency across the application.

-            padding: '15px 20px',
+            padding: `${theme.spacing(2)}px ${theme.spacing(2.5)}px`,

876-878: Consider extracting common button styles.

The confirm button styles share common properties with other buttons (padding, fontWeight, boxShadow). Consider extracting these into a base button style.

+        baseButtonStyles: Object.freeze({
+            padding: '15px 25px',
+            fontWeight: theme.typography.fontWeightBold,
+            boxShadow: 'none',
+        }),
         confirmButtonStyles: Object.freeze({
+            ...baseButtonStyles,
             backgroundColor: COLOURS.MINT_GREEN,
-            padding: '15px 25px',
-            fontWeight: theme.typography.fontWeightBold,
-            boxShadow: 'none',
             '&:hover': { backgroundColor: COLOURS.OLIVA_GREEN },
         }),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a23c67 and cab8a47.

📒 Files selected for processing (5)
  • doc/release/RELEASE-NOTES.md (1 hunks)
  • src/django/api/tests/base_moderation_events_production_location_test.py (2 hunks)
  • src/react/src/util/constants.jsx (1 hunks)
  • src/react/src/util/styles.js (4 hunks)
  • src/react/src/util/util.js (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/react/src/util/constants.jsx
  • src/django/api/tests/base_moderation_events_production_location_test.py
  • src/react/src/util/util.js
⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: run-fe-code-quality
  • GitHub Check: run-django-code-quality
🔇 Additional comments (6)
src/react/src/util/styles.js (6)

787-788: LGTM! Backdrop z-index values are appropriate.

The z-index values for backdrop states are correctly defined, with open state having higher z-index (100) for visibility and closed state having negative z-index (-1) to ensure it's hidden behind other elements.


811-815: LGTM! Container styles follow design system.

The container styles appropriately use design system colors and maintain consistency with borderless design through boxShadow: 'none'.


816-828: LGTM! Status styles use semantic colors.

The moderation event status styles use appropriate semantic colors for different states:

  • Pending: PALE_LIGHT_YELLOW
  • Approved: MINT_GREEN
  • Rejected: LIGHT_RED

838-840: LGTM! Confirmed state uses consistent color.

The confirmed state style uses the same MINT_GREEN color as the approved status for visual consistency.


865-872: LGTM! Responsive button content layout.

The button content style properly handles responsive layout using theme breakpoints for mobile view.


885-887: LGTM! Clear visual indication for disabled state.

The claim tooltip wrapper appropriately uses not-allowed cursor to indicate the disabled state.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
doc/release/RELEASE-NOTES.md (1)

37-46: Fix markdown formatting for better readability.

The list items under OSDEV-1117 use inconsistent indentation and bullet point styles. Consider using consistent asterisks (*) for bullet points and proper indentation.

-    - Connected GET `api/v1/moderation-events/{moderation_id}/`.
-    - Connected GET `api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address}` to get potential matches using OpenSearch engine.
-    - Connected PATCH `/v1/moderation-events/{moderation_id}/` (for Reject button).
-    - Connected POST `/v1/moderation-events/{moderation_id}/production-locations/` (for Create New Location button).
-    - Connected PATCH `/v1/moderation-events/{moderation_id}/production-locations/{os_id}/` (for Confirm potential match button).
-    - UI improvements: 
-        - Added a toast component to display notifications during moderation event updates.
-        - Introduced a backdrop to prevent accidental clicks on other buttons during the update process.
-    - Applied Django Signal for moderation-events OpenSearch index.
+  * Connected GET `api/v1/moderation-events/{moderation_id}/`.
+  * Connected GET `api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address}` to get potential matches using OpenSearch engine.
+  * Connected PATCH `/v1/moderation-events/{moderation_id}/` (for Reject button).
+  * Connected POST `/v1/moderation-events/{moderation_id}/production-locations/` (for Create New Location button).
+  * Connected PATCH `/v1/moderation-events/{moderation_id}/production-locations/{os_id}/` (for Confirm potential match button).
+  * UI improvements: 
+    * Added a toast component to display notifications during moderation event updates.
+    * Introduced a backdrop to prevent accidental clicks on other buttons during the update process.
+  * Applied Django Signal for moderation-events OpenSearch index.
🧰 Tools
🪛 Markdownlint (0.37.0)

38-38: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


39-39: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


40-40: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


41-41: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


42-42: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


43-43: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


44-44: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


45-45: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


46-46: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


38-38: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


39-39: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


40-40: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


41-41: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


42-42: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


43-43: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


44-44: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


45-45: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


46-46: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cab8a47 and f3d5c83.

📒 Files selected for processing (2)
  • doc/release/RELEASE-NOTES.md (1 hunks)
  • src/react/src/actions/dashboardContributionRecord.js (1 hunks)
🧰 Additional context used
🪛 Markdownlint (0.37.0)
doc/release/RELEASE-NOTES.md

38-38: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


39-39: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


40-40: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


41-41: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


42-42: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


43-43: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


44-44: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


45-45: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


46-46: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


38-38: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


39-39: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


40-40: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


41-41: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


42-42: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


43-43: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


44-44: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


45-45: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


46-46: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)

⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-fe-code-quality
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: run-django-code-quality
🔇 Additional comments (5)
src/react/src/actions/dashboardContributionRecord.js (5)

47-51: LGTM! Good use of payload transformers to handle missing status property.

The explicit status updates in the action creators for completeCreateProductionLocationFromModerationEvent and completeConfirmPotentialMatchFromModerationEvent ensure proper UI handling, with helpful comments explaining why this is necessary.

Also applies to: 62-66


73-94: LGTM! Well-structured async function with proper error handling.

The implementation includes:

  • Input validation for moderationID
  • Proper async/await usage
  • Comprehensive error handling with descriptive messages

96-132: LGTM! Consistent implementation pattern with proper data handling.

The function maintains consistency with other API calls in the file, featuring:

  • Clean data destructuring
  • Proper response handling
  • Consistent error handling pattern

133-181: LGTM! Consistent implementation of update and create operations.

Both functions maintain the established patterns with:

  • Proper parameter validation
  • Consistent error handling
  • Clear action dispatching

Line range hint 183-211: LGTM! Consistent implementation of match confirmation.

The function maintains the codebase's patterns with:

  • Proper parameter validation
  • Consistent error handling
  • Clear action dispatching

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
doc/release/RELEASE-NOTES.md (1)

Line range hint 1-42: Fix markdown formatting issues

The markdown has some formatting inconsistencies:

  • Unordered lists use dashes (-) instead of asterisks (*)
  • List indentation is inconsistent (4 spaces vs 2 spaces)
  • Some headings have trailing colons

Apply these changes to fix the formatting:

  1. Replace dashes with asterisks for unordered lists
  2. Use consistent 2-space indentation for lists
  3. Remove trailing colons from headings
🧰 Tools
🪛 Markdownlint (0.37.0)

30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


35-35: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


36-36: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


37-37: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


38-38: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


35-35: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


36-36: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


37-37: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


38-38: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


46-46: null
Multiple headings with the same content

(MD024, no-duplicate-heading)


13-13: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


40-40: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3d5c83 and 74c3a43.

📒 Files selected for processing (1)
  • doc/release/RELEASE-NOTES.md (1 hunks)
🧰 Additional context used
🪛 Markdownlint (0.37.0)
doc/release/RELEASE-NOTES.md

30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


35-35: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


36-36: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


37-37: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


38-38: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


35-35: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


36-36: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


37-37: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


38-38: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


13-13: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


40-40: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-fe-code-quality
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-django-code-quality
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-contricleaner-cov
🔇 Additional comments (4)
doc/release/RELEASE-NOTES.md (4)

19-21: Code/API changes section needs to be populated

The code/API changes section contains placeholder text. Please document the API changes mentioned in the "What's new" section, including:

  • Changes to request/response formats
  • Any breaking changes
  • New API endpoints and their specifications

22-24: Architecture changes section needs to be populated

The architecture changes section contains placeholder text. Please document any architectural changes, particularly around:

  • Django Signals implementation for OpenSearch indexing
  • Any changes to the system's architecture for handling moderation events

40-42: Release instructions section needs to be populated

The release instructions section contains placeholder text. Based on the changes described, please include:

  1. Required database migrations
  2. Steps for OpenSearch reindexing
  3. Any other post-deployment tasks
🧰 Tools
🪛 Markdownlint (0.37.0)

40-40: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


12-18: Database changes section needs to be populated

The database changes section contains placeholder text. Please document any database migrations or schema changes introduced by the contribution record integration.

🧰 Tools
🪛 Markdownlint (0.37.0)

13-13: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
doc/release/RELEASE-NOTES.md (2)

29-39: Fix list formatting inconsistencies

The list formatting in the "What's new" section is inconsistent. The indentation and bullet point style should be standardized.

Apply this diff to fix the formatting:

### What's new
* [OSDEV-40](https://opensupplyhub.atlassian.net/browse/OSDEV-40) - Created new page for `/contribute` to choose between multiple & single location upload. Replaced current multiple list upload to `/contribute/multiple-locations`. Changed `Upload Data` to `Add Data` text.
* [OSDEV-1117](https://opensupplyhub.atlassian.net/browse/OSDEV-1117) - Implemented integration of Contribution Record Page (`/dashboard/moderation-queue/contribution-record/{moderation_id}`):
  * Connected GET `api/v1/moderation-events/{moderation_id}/`.
  * Connected GET `api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address}` to get potential matches using OpenSearch engine.
  * Connected PATCH `/v1/moderation-events/{moderation_id}/` (for Reject button).
  * Connected POST `/v1/moderation-events/{moderation_id}/production-locations/` (for Create New Location button).
  * Connected PATCH `/v1/moderation-events/{moderation_id}/production-locations/{os_id}/` (for Confirm potential match button).
  * UI improvements:
    * Added a toast component to display notifications during moderation event updates.
    * Introduced a backdrop to prevent accidental clicks on other buttons during the update process.
  * Applied Django Signal for moderation-events OpenSearch index.
🧰 Tools
🪛 Markdownlint (0.37.0)

31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


35-35: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


36-36: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


37-37: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


38-38: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


39-39: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


35-35: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


36-36: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


37-37: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


38-38: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


39-39: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


Line range hint 41-44: Add details about required database migrations

The release instructions mention running migrate and reindex_database commands but don't specify which migrations are included in this release. Please add details about any new migrations that need to be applied.

🧰 Tools
🪛 Markdownlint (0.37.0)

31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


35-35: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


36-36: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


37-37: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


38-38: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


39-39: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


35-35: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


36-36: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


37-37: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


38-38: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


39-39: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


13-13: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


41-41: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

src/react/src/util/styles.js (1)

838-840: Consider reusing the approved status background color.

The listItemStyle_confirmed uses the same background color as moderationEventStatus_approved. Consider creating a shared constant or reusing the existing style to maintain consistency and reduce duplication.

-        listItemStyle_confirmed: Object.freeze({
-            backgroundColor: COLOURS.MINT_GREEN,
-        }),
+        listItemStyle_confirmed: Object.freeze({
+            ...moderationEventStatus_approved,
+        }),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74c3a43 and 01bdfdc.

📒 Files selected for processing (3)
  • doc/release/RELEASE-NOTES.md (1 hunks)
  • src/react/src/util/constants.jsx (1 hunks)
  • src/react/src/util/styles.js (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/react/src/util/constants.jsx
🧰 Additional context used
🪛 Markdownlint (0.37.0)
doc/release/RELEASE-NOTES.md

31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


35-35: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


36-36: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


37-37: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


38-38: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


39-39: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


35-35: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


36-36: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


37-37: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


38-38: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


39-39: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)

⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: run-django-code-quality
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: run-fe-code-quality
🔇 Additional comments (5)
src/react/src/util/styles.js (5)

787-788: LGTM! Backdrop z-index values are well chosen.

The z-index values effectively manage the backdrop visibility, with 100 for showing above content and -1 for hiding behind content.


802-815: LGTM! Consistent styling with the design system.

The button dimensions and container styles align well with the application's design patterns. The sharp edges (border-radius: 0) and consistent spacing maintain visual harmony.


865-878: LGTM! Good responsive design implementation.

The button styles handle mobile responsiveness well with appropriate breakpoints. The confirm button maintains consistent spacing and uses semantic colors.


885-887: LGTM! Clear visual indication of disabled state.

The cursor: not-allowed property effectively communicates that the element is not interactive.


816-828: Consider adding color contrast checks for accessibility.

The moderation event status styles use semantic colors effectively. However, ensure that the text color (NEAR_BLACK) has sufficient contrast with the background colors for accessibility.

Run the following script to check if there are any existing color contrast utilities or tests:

✅ Verification successful

Color contrast considerations are already well-implemented

The codebase demonstrates proper color contrast handling through Material-UI's contrast utilities and theme-based color management. The moderation status styles follow the established patterns with semantic colors and consistent text contrast.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for color contrast utilities or tests
# Look for color contrast related files or tests
rg -i "color.*contrast|wcag|a11y|accessibility" --type js

Length of output: 1581

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
doc/release/RELEASE-NOTES.md (2)

25-34: Consider using asterisks for bullet points to maintain consistent markdown style.

Replace dashes with asterisks for bullet points to follow markdown best practices.

-    - Connected GET `api/v1/moderation-events/{moderation_id}/`.
+    * Connected GET `api/v1/moderation-events/{moderation_id}/`.
-    - Connected GET `api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address}` to get potential matches using OpenSearch engine.
+    * Connected GET `api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address}` to get potential matches using OpenSearch engine.
-    - Connected PATCH `/v1/moderation-events/{moderation_id}/` (for Reject button).
+    * Connected PATCH `/v1/moderation-events/{moderation_id}/` (for Reject button).
-    - Connected POST `/v1/moderation-events/{moderation_id}/production-locations/` (for Create New Location button).
+    * Connected POST `/v1/moderation-events/{moderation_id}/production-locations/` (for Create New Location button).
-    - Connected PATCH `/v1/moderation-events/{moderation_id}/production-locations/{os_id}/` (for Confirm potential match button).
+    * Connected PATCH `/v1/moderation-events/{moderation_id}/production-locations/{os_id}/` (for Confirm potential match button).
-    - UI improvements: 
+    * UI improvements: 
-        - Added a toast component to display notifications during moderation event updates.
+        * Added a toast component to display notifications during moderation event updates.
-        - Introduced a backdrop to prevent accidental clicks on other buttons during the update process.
+        * Introduced a backdrop to prevent accidental clicks on other buttons during the update process.
-    - Applied Django Signal for moderation-events OpenSearch index.
+    * Applied Django Signal for moderation-events OpenSearch index.
🧰 Tools
🪛 Markdownlint (0.37.0)

26-26: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


27-27: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


28-28: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


29-29: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


26-26: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


27-27: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


28-28: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


29-29: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


25-31: Consider moving API endpoints to the Code/API changes section.

For better organization, consider moving the API endpoint documentation from "What's new" to the "Code/API changes" section:

### Code/API changes
* Connected GET `api/v1/moderation-events/{moderation_id}/`
* Connected GET `api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address}` to get potential matches using OpenSearch engine
* Connected PATCH `/v1/moderation-events/{moderation_id}/` (for Reject button)
* Connected POST `/v1/moderation-events/{moderation_id}/production-locations/` (for Create New Location button)
* Connected PATCH `/v1/moderation-events/{moderation_id}/production-locations/{os_id}/` (for Confirm potential match button)
🧰 Tools
🪛 Markdownlint (0.37.0)

26-26: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


27-27: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


28-28: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


29-29: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


26-26: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


27-27: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


28-28: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


29-29: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01bdfdc and c94cce8.

📒 Files selected for processing (1)
  • doc/release/RELEASE-NOTES.md (1 hunks)
🧰 Additional context used
🪛 Markdownlint (0.37.0)
doc/release/RELEASE-NOTES.md

26-26: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


27-27: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


28-28: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


29-29: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


26-26: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


27-27: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


28-28: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


29-29: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-django-code-quality
  • GitHub Check: get-base-branch-django-cov
🔇 Additional comments (1)
doc/release/RELEASE-NOTES.md (1)

Line range hint 8-19: Populate or remove empty sections.

The following sections are empty and should either be populated with actual content or removed to maintain clear documentation:

  • Database changes/Migrations
  • Database changes/Scheme changes
  • Code/API changes
  • Architecture/Environment changes
  • Bugfix
🧰 Tools
🪛 Markdownlint (0.37.0)

26-26: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


27-27: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


28-28: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


29-29: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


26-26: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


27-27: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


28-28: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


29-29: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


36-36: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)

roman-stolar
roman-stolar previously approved these changes Jan 7, 2025
Copy link
Contributor

@roman-stolar roman-stolar left a comment

Choose a reason for hiding this comment

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

Looks great!
@Innavin369 Please review answers to your opened conversation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
doc/release/RELEASE-NOTES.md (1)

Line range hint 1-24: Remove empty placeholder sections

The following sections contain placeholder text and should be removed since they appear to have no changes to document:

  • Database changes/Migrations
  • Database changes/Scheme changes
  • Code/API changes
  • Architecture/Environment changes
  • Bugfix

This helps maintain clear and accurate release documentation.

🧰 Tools
🪛 Markdownlint (0.37.0)

26-26: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


27-27: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


28-28: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


29-29: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


26-26: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


27-27: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


28-28: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


29-29: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


37-37: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)

🧹 Nitpick comments (2)
doc/release/RELEASE-NOTES.md (2)

25-34: Enhance API endpoint documentation

The API endpoint documentation could be improved by:

  1. Adding HTTP response codes for each endpoint
  2. Specifying request/response payload formats
  3. Including example requests/responses

Would you like me to help generate the enhanced API documentation?

🧰 Tools
🪛 Markdownlint (0.37.0)

26-26: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


27-27: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


28-28: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


29-29: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


26-26: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


27-27: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


28-28: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


29-29: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


25-34: Fix markdown list formatting

The list indentation and bullet point style is inconsistent. Use asterisks (*) instead of dashes (-) for bullet points and maintain consistent indentation (2 spaces for first level, 4 spaces for nested levels).

Apply this formatting:

* [OSDEV-1117](https://opensupplyhub.atlassian.net/browse/OSDEV-1117) - Implemented integration of Contribution Record Page (`/dashboard/moderation-queue/contribution-record/{moderation_id}`):
  * Connected GET `api/v1/moderation-events/{moderation_id}/`.
  * Connected GET `api/v1/production-locations?name={productionLocationName}&country={countryCode}&address={address}` to get potential matches using OpenSearch engine.
  * Connected PATCH `/v1/moderation-events/{moderation_id}/` (for Reject button).
  * Connected POST `/v1/moderation-events/{moderation_id}/production-locations/` (for Create New Location button).
  * Connected PATCH `/v1/moderation-events/{moderation_id}/production-locations/{os_id}/` (for Confirm potential match button).
  * UI improvements:
    * Added a toast component to display notifications during moderation event updates.
    * Introduced a backdrop to prevent accidental clicks on other buttons during the update process.
  * Applied Django Signal for moderation-events OpenSearch index.
🧰 Tools
🪛 Markdownlint (0.37.0)

26-26: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


27-27: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


28-28: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


29-29: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


26-26: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


27-27: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


28-28: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


29-29: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c94cce8 and 96d06f2.

📒 Files selected for processing (3)
  • doc/release/RELEASE-NOTES.md (1 hunks)
  • src/react/src/util/constants.jsx (1 hunks)
  • src/react/src/util/styles.js (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/react/src/util/constants.jsx
🧰 Additional context used
🪛 Markdownlint (0.37.0)
doc/release/RELEASE-NOTES.md

26-26: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


27-27: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


28-28: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


29-29: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


30-30: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


31-31: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


32-32: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


33-33: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


34-34: Expected: asterisk; Actual: dash
Unordered list style

(MD004, ul-style)


26-26: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


27-27: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


28-28: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


29-29: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


30-30: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


31-31: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)


32-32: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


33-33: Expected: 4; Actual: 8
Unordered list indentation

(MD007, ul-indent)


34-34: Expected: 2; Actual: 4
Unordered list indentation

(MD007, ul-indent)

⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-fe-code-quality
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-django-code-quality
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-dd-cov
🔇 Additional comments (8)
src/react/src/util/styles.js (8)

767-768: LGTM! Backdrop z-index values are appropriate.

The z-index values of 100 and -1 are suitable for showing/hiding a backdrop overlay.


782-785: LGTM! Button styles enhance consistency.

The updated padding, minimum width, and removal of box shadow improve the button's visual consistency and alignment with flat design principles.


791-795: LGTM! Container styles follow modern design principles.

The flat design with subtle border and background color provides appropriate visual hierarchy and separation.


796-808: LGTM! Moderation event status styles use semantic colors.

The background colors effectively communicate the state: yellow for pending, green for approved, and red for rejected, enhancing user understanding.


818-820: LGTM! Confirmed item style is consistent.

The mint green background color aligns with the approved state styling.


845-852: LGTM! Button content style handles responsive layout well.

The flex layout and mobile-specific adjustments ensure proper content alignment across devices.


856-858: LGTM! Confirm button styles maintain consistency.

The padding, font weight, and flat design align with the established button styling patterns.


865-867: LGTM! Claim tooltip wrapper correctly indicates disabled state.

The 'not-allowed' cursor appropriately signals that the element is non-interactive.

Innavin369
Innavin369 previously approved these changes Jan 8, 2025
Copy link
Contributor

@Innavin369 Innavin369 left a comment

Choose a reason for hiding this comment

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

LGTM

roman-stolar
roman-stolar previously approved these changes Jan 9, 2025
Copy link
Contributor

@roman-stolar roman-stolar left a comment

Choose a reason for hiding this comment

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

Re-Approved.

Copy link
Contributor

@mazursasha1990 mazursasha1990 left a comment

Choose a reason for hiding this comment

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

Left several comments.
Also, please fix the console error:
Screenshot from 2025-01-09 13-06-40

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 9, 2025

@VadimKovalenkoSNF
Copy link
Contributor Author

@mazursasha1990 I fixed proptypes warnings for DialogTooltip component, pls check.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (6)
src/react/src/actions/dashboardContributionRecord.js (2)

47-51: Add a comment explaining the status update logic.

The status property is being explicitly added to the payload since it's not included in the API response. Consider adding a comment explaining why this is necessary for proper UI handling.

 export const completeCreateProductionLocationFromModerationEvent = createAction(
     'COMPLETE_CREATE_PRODUCTION_LOCATION_FROM_MODERATION_EVENT',
-    // We need to explicitly update the status for proper UI handling
-    // The status property doesn't exist in 'POST /v1/moderation-events/{moderation_id}/production-locations/' response
+    // Explicitly set status to APPROVED since the API response doesn't include it.
+    // This ensures the UI correctly reflects the moderation event's state after creating a production location.
     payload => ({
         ...payload,
         status: MODERATION_STATUSES_ENUM.APPROVED,

96-131: Consider adding error handling for empty data.

The function should handle cases where the required data properties are missing or undefined.

 export function fetchPotentialMatches(data) {
     return dispatch => {
         dispatch(startFetchPotentialMatches());
 
+        if (!data || typeof data !== 'object') {
+            return dispatch(
+                logErrorAndDispatchFailure(
+                    new Error('Invalid data object'),
+                    'Invalid data provided for fetching potential matches',
+                    failFetchPotentialMatches,
+                ),
+            );
+        }
+
         const {
             productionLocationName,
             countryCode,
             productionLocationAddress,
         } = data;
src/react/src/components/Dashboard/DashboardContributionRecord.jsx (4)

124-142: Consider using a custom hook for toast management.

The toast and backdrop management logic could be extracted into a custom hook for better reusability and separation of concerns.

// Example custom hook
const useToastWithBackdrop = (message, error) => {
  const [showBackdrop, setShowBackdrop] = useState(false);

  useEffect(() => {
    if (message || error) {
      setShowBackdrop(true);
      toast(error || message, {
        onClose: () => setShowBackdrop(false),
      });
    }
  }, [message, error]);

  return showBackdrop;
};

170-170: Remove TODO comment or create an issue.

The TODO comment about automatic write claim should be tracked in the issue tracker.

Would you like me to create a GitHub issue to track this TODO item?


317-351: Consider extracting button logic to a separate component.

The conditional rendering of the confirm button and its tooltip could be extracted into a separate component for better maintainability.

// Example component
const ConfirmButton = ({ isDisabled, moderationEventFetching, osId, matchOsId, onConfirm, classes }) => {
  if (isDisabled) {
    return (
      <DialogTooltip
        text={osId === matchOsId
          ? `Moderation event data has been already matched to this production location.`
          : `You can't confirm potential match when moderation event is ${moderationEventStatus.toLowerCase()}.`}
        aria-label="Confirm potential match button tooltip"
        childComponent={confirmPotentialMatchButtonDisabled(classes, osId, matchOsId)}
      />
    );
  }

  return (
    <Button
      color="secondary"
      variant="contained"
      className={classes.confirmButtonStyles}
      disabled={moderationEventFetching}
      onClick={onConfirm}
    >
      {confirmPotentialMatchButtonTitle}
    </Button>
  );
};

395-419: Consider extracting claim button logic to a separate component.

Similar to the confirm button, the claim button logic could be extracted into a separate component.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 96d06f2 and 5ea1f43.

📒 Files selected for processing (4)
  • src/react/src/actions/dashboardContributionRecord.js (1 hunks)
  • src/react/src/actions/dashboardModerationQueue.js (4 hunks)
  • src/react/src/components/Contribute/DialogTooltip.jsx (1 hunks)
  • src/react/src/components/Dashboard/DashboardContributionRecord.jsx (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/react/src/components/Contribute/DialogTooltip.jsx
⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-fe-code-quality
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-django-code-quality
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: get-base-branch-countries-cov
  • GitHub Check: get-base-branch-contricleaner-cov
🔇 Additional comments (9)
src/react/src/actions/dashboardModerationQueue.js (4)

10-17: LGTM! Action creators follow Redux best practices.

The action creators are well-structured with clear, descriptive action types following a consistent naming convention.


28-35: LGTM! Action creators follow Redux best practices.

The action creators are well-structured with clear, descriptive action types following a consistent naming convention.


Line range hint 39-83: LGTM! Thunk implementation follows best practices.

The function correctly handles the API request lifecycle with proper error handling and uses the updated action creator names.


Line range hint 85-102: LGTM! Thunk implementation follows best practices.

The function correctly handles the download operation lifecycle with proper error handling and uses the updated action creator names.

src/react/src/actions/dashboardContributionRecord.js (4)

73-94: LGTM! Proper error handling and null check.

The function includes proper error handling using logErrorAndDispatchFailure and checks for null moderationID.


133-156: LGTM! Proper error handling and null check.

The function includes proper error handling using logErrorAndDispatchFailure and checks for null moderationID.


157-181: LGTM! Proper error handling and null check.

The function includes proper error handling using logErrorAndDispatchFailure and checks for null moderationID.


Line range hint 183-211: LGTM! Proper error handling and null check.

The function includes proper error handling using logErrorAndDispatchFailure and checks for null moderationID.

src/react/src/components/Dashboard/DashboardContributionRecord.jsx (1)

111-122: Consider adding fetchModerationEvent to useEffect dependencies.

The empty dependency array means this effect only runs once on mount. If fetchModerationEvent changes (unlikely but possible with Redux), it won't be reflected.

However, based on the past review comments, this was intentionally designed to fetch data only once on mount. If this is the intended behavior, consider adding a comment explaining this design decision.

Copy link
Contributor

@mazursasha1990 mazursasha1990 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants