-
Notifications
You must be signed in to change notification settings - Fork 1
feat(llc): add activity feedback support #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR regenerates the client-side API models and endpoints, incorporating numerous additions and breaking changes from a recent backend API update. ### Breaking Changes - **`queryFollowSuggestions`:** The method signature and return type have changed. It now returns a `Result<List<FeedSuggestionData>>` instead of `Result<List<FeedData>>`. The new `FeedSuggestionData` model includes additional metadata like `reason`, `recommendationScore`, and `algorithmScores`. - **`FeedsReactionData.id`:** The logic for generating a reaction's unique ID has been updated to correctly include the `commentId` when present, ensuring proper identification for comment reactions. ### Features - **Collections API:** Added full support for the Collections API, including new request/response models and endpoints for creating, reading, updating, and deleting collections (`CreateCollections`, `ReadCollections`, `UpdateCollections`, `DeleteCollections`). - **`ActivityData` Enhancements:** Added `hidden` and `preview` boolean fields to the `ActivityData` model to support content hiding and previewing functionalities. - **`FeedSuggestionData` Model:** Introduced a new `FeedSuggestionData` model to encapsulate feed suggestions, providing richer context with algorithmic scores and reasons. - **Moderation and Deletion Reasons:** Added an optional `reason` field to various deletion and moderation requests (`DeleteActivityRequest`, `DeleteCommentRequest`, `DeleteReactionRequest`, `DeleteUserRequest`, `BlockActionRequest`, `ShadowBlockActionRequest`) to provide context for moderation actions. ### Other Key Changes - **API Model Updates:** - `ActivityRequest` and `UpdateActivityRequest` now include `collectionRefs`, `restrictReplies`, and `skipEnrichUrl`. - `ActivityResponse` now includes `collections`, `moderationAction`, `preview`, `hidden`, and `restrictReplies`. - `ChannelMemberResponse` and related models have been significantly expanded with new fields like `banned`, `createdAt`, `custom`, `role`, and more. - `ChannelResponse` and `Channel` models now include `filterTags`. - Introduced `ActivityFeedbackEvent` for real-time feedback updates. - Deprecated `muteUser` and `report` from `ActivityFeedbackRequest`. - **Endpoint and Request Adjustments:** - Made `addCommentRequest` in the `addComment` endpoint nullable. - Removed the deprecated `activitySelectorOptions` from `FeedQuery` and `GetOrCreateFeedRequest`. - **Testing:** Added tests for the new `queryFollowSuggestions` functionality to validate the handling of `FeedSuggestionData`.
This commit pins the `retrofit` dependency to a version range of `>=4.6.0 <=4.9.0`. This change is necessary to avoid a breaking change introduced in `retrofit` version 4.10.0. The version constraint is applied in the root `melos.yaml` and the `packages/stream_feeds/pubspec.yaml` file.
This commit introduces the ability to submit feedback for activities, such as marking an activity as hidden. It adds an `activityFeedback` method to the `Activity` and `Feed` classes and handles real-time state updates via WebSocket events.
Key changes:
- **API**: Added `activityFeedback` method to `ActivitiesRepository`, `Activity`, and `Feed` to allow submitting feedback (e.g., hide/unhide).
- **State Management**: Implemented `onActivityHidden` handlers in `ActivityState`, `ActivityListState`, and `FeedState` to update the `hidden` status of activities in response to `ActivityFeedbackEvent` from WebSockets.
- **Event Handling**: `ActivityEventHandler`, `ActivityListEventHandler`, and `FeedEventHandler` now process `ActivityFeedbackEvent` to trigger state updates, ensuring the UI reflects whether an activity is hidden.
- **Testing**:
- Introduced a new suite of test utilities (`BaseTester`, `ActivityTester`, `FeedTester`, `ActivityListTester`, `ApiMockerMixin`) to streamline testing of stateful objects with API and WebSocket interactions.
- Added comprehensive tests for the new activity feedback functionality, covering both API calls and real-time event handling.
- **Refactor**: Minor refactoring in test helpers (`fakes.dart`) to improve consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces activity feedback support to the Stream Feeds SDK, enabling users to submit feedback for activities (e.g., marking activities as hidden/unhidden) with real-time WebSocket event handling. The implementation follows established architectural patterns and includes a comprehensive test infrastructure to streamline testing of stateful objects with API and WebSocket interactions.
Key Changes:
- Added
activityFeedbackAPI method toActivity,Feed, andActivitiesRepositoryclasses for submitting feedback - Implemented real-time state updates via
onActivityHiddenhandlers inActivityState,ActivityListState, andFeedStateto reflect hidden status changes from WebSocket events - Created a new test utilities framework (
BaseTester,ActivityTester,FeedTester,ActivityListTester,ApiMockerMixin) to simplify testing of stateful objects with mocked APIs and WebSocket interactions
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/stream_feeds/lib/src/repository/activities_repository.dart |
Added activityFeedback method to submit activity feedback via API |
packages/stream_feeds/lib/src/state/activity.dart |
Added activityFeedback method and integrated ActivityEventHandler with currentUserId and activityId |
packages/stream_feeds/lib/src/state/feed.dart |
Added activityFeedback method and passed currentUserId to FeedEventHandler |
packages/stream_feeds/lib/src/state/activity_list.dart |
Passed currentUserId to ActivityListEventHandler for event filtering |
packages/stream_feeds/lib/src/state/activity_state.dart |
Added onActivityHidden handler to update activity hidden status |
packages/stream_feeds/lib/src/state/feed_state.dart |
Added onActivityHidden handler to update hidden status in both activities and pinned activities lists |
packages/stream_feeds/lib/src/state/activity_list_state.dart |
Added onActivityHidden handler to update activity hidden status in list |
packages/stream_feeds/lib/src/state/event/activity_event_handler.dart |
Added handling for ActivityFeedbackEvent with user and activity ID filtering |
packages/stream_feeds/lib/src/state/event/feed_event_handler.dart |
Added handling for ActivityFeedbackEvent with user ID filtering |
packages/stream_feeds/lib/src/state/event/activity_list_event_handler.dart |
Added handling for ActivityFeedbackEvent with user ID filtering |
packages/stream_feeds/test/test_utils/testers/base_tester.dart |
New test infrastructure providing common functionality for testers with WebSocket support |
packages/stream_feeds/test/test_utils/testers/api_mocker_mixin.dart |
New mixin for mocking and verifying API calls in tests |
packages/stream_feeds/test/test_utils/testers/activity_tester.dart |
New test helper for activity operations with WebSocket support |
packages/stream_feeds/test/test_utils/testers/feed_tester.dart |
New test helper for feed operations with WebSocket support |
packages/stream_feeds/test/test_utils/testers/activity_list_tester.dart |
New test helper for activity list operations with WebSocket support |
packages/stream_feeds/test/test_utils/fakes.dart |
Refactored to extract createDefaultActivityResponse and added createDefaultActivityFeedbackResponse |
packages/stream_feeds/test/test_utils/event_types.dart |
Added activityFeedback event type constant |
packages/stream_feeds/test/state/activity_test.dart |
Added comprehensive tests for activity feedback API and events |
packages/stream_feeds/test/state/feed_test.dart |
Added comprehensive tests for feed activity feedback API and events |
packages/stream_feeds/test/state/activity_list_test.dart |
Added comprehensive tests for activity list feedback events |
packages/stream_feeds/CHANGELOG.md |
Documented the new activityFeedback feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #58 +/- ##
==========================================
+ Coverage 43.42% 45.04% +1.61%
==========================================
Files 121 121
Lines 3675 3730 +55
==========================================
+ Hits 1596 1680 +84
+ Misses 2079 2050 -29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…k-operation # Conflicts: # packages/stream_feeds/CHANGELOG.md # packages/stream_feeds/test/state/feed_test.dart # packages/stream_feeds/test/test_utils/fakes.dart
Submit a pull request
Closes FLU-312
Description of the pull request
This PR introduces the ability to submit feedback for activities, such as marking an activity as hidden. It adds an
activityFeedbackmethod to theActivityandFeedclasses and handles real-time state updates via WebSocket events.Key changes:
activityFeedbackmethod toActivitiesRepository,Activity, andFeedto allow submitting feedback (e.g., hide/unhide).onActivityHiddenhandlers inActivityState,ActivityListState, andFeedStateto update thehiddenstatus of activities in response toActivityFeedbackEventfrom WebSockets.ActivityEventHandler,ActivityListEventHandler, andFeedEventHandlernow processActivityFeedbackEventto trigger state updates, ensuring the UI reflects whether an activity is hidden.- Introduced a new suite of test utilities (
BaseTester,ActivityTester,FeedTester,ActivityListTester,ApiMockerMixin) to streamline testing of stateful objects with API and WebSocket interactions.- Added comprehensive tests for the new activity feedback functionality, covering both API calls and real-time event handling.
fakes.dart) to improve consistency.