Skip to content

Feature/owner response to reviews 108#120

Open
Ceejaytech25 wants to merge 2 commits into
HubDApp:mainfrom
Ceejaytech25:feature/owner-response-to-reviews-108
Open

Feature/owner response to reviews 108#120
Ceejaytech25 wants to merge 2 commits into
HubDApp:mainfrom
Ceejaytech25:feature/owner-response-to-reviews-108

Conversation

@Ceejaytech25
Copy link
Copy Markdown

Description

This Pull Request introduces two significant functional enhancements to the Dongle Smart Contract, expanding community moderation capabilities and discoverability for projects.

Add Optional Project Owner Response to Reviews (#108)

Previously, project owners had no way to publicly respond to reviews on their projects, limiting context, moderation, and communication.

  • Added owner_response to Review struct so project owners can leave an optional response.
  • Implemented respond_to_review: A secure method allowing only the verified project owner to add or update a response to a review.
  • Updated Review Events: Emits the owner_response data when reviews are interacted with so indexers and frontends can catch updates immediately.
  • Exposed get_review_response getter to fetch just the response tied to a review.

Add Search and Filter Indexes for Categories (#110)

Previously, it was not possible to query projects grouped by their category without filtering on the frontend/indexer.

  • Added CategoryProjects(String) Storage Key: Introduced a dedicated mapping to track lists of project IDs for each category name.
  • Automatic Index Maintenance:
    • register_project: Appends the newly generated Project ID to its corresponding category index automatically.
    • update_project: Securely removes the Project ID from the old category and transitions it to the new category if a project decides to switch categories.
  • Implemented list_projects_by_category: Exposes a new deterministic, paginated getter to retrieve a list of projects efficiently under a specific category.
  • TTL Extensions: Configured automatic TTL extension for the CategoryProjects indexes to prevent crucial lists from archiving out of ledger storage.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix / Housekeeping (non-breaking change which fixes an issue - addressed unused variable and duplicate discriminant issues)

How Has This Been Tested?

Comprehensive testing suites were added and executed to assure data correctness, authorization, and pagination.

Owner Response to Reviews:

  • test_respond_to_review_success: Verified owners can successfully add responses and fetch them correctly.
  • test_respond_to_review_unauthorized_fails: Ensured unauthorized wallets (non-owners) get appropriately rejected.
  • test_respond_to_review_not_found_fails: Handled missing reviews elegantly.

Category Indexing:

  • test_list_projects_by_category_basic: Validated registration naturally groups projects into their right categories.
  • test_list_projects_by_category_update_moves_project: Asserted that updating a project correctly transitions the ID into the new category without leaving stale data.
  • test_list_projects_by_category_pagination: Proved that chunking and deterministic pagination limit clauses are enforced safely without skipping or overlapping records.
  • test_list_projects_by_category_empty: Confirmed empty returns occur smoothly on missing/unknown categories.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Closes #108
Closes #110
Closes #105
Closes #111

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@Ceejaytech25 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Ceejaytech25
Copy link
Copy Markdown
Author

@Naomi-Gift , pls review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants