Skip to content

feat(llc): expose restrictReplies on ActivityData and FeedAddActivityRequest#108

Open
renefloor wants to merge 7 commits into
mainfrom
renefloor/flu-356-integrate-comment-replies-restriction-feature-in-api
Open

feat(llc): expose restrictReplies on ActivityData and FeedAddActivityRequest#108
renefloor wants to merge 7 commits into
mainfrom
renefloor/flu-356-integrate-comment-replies-restriction-feature-in-api

Conversation

@renefloor

@renefloor renefloor commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds ActivityRestrictReplies extension type (everyone / nobody / peopleIFollow) to the domain layer
  • Exposes restrictReplies on ActivityData (read model) mapped from ActivityResponseRestrictReplies
  • Adds restrictReplies: AddActivityRequestRestrictReplies? to FeedAddActivityRequest so integrators can control comment restrictions when creating an activity
  • Note: own_followings on FeedData was already present from the codegen in feat(llc): update openapi models #106 — no change needed there

Test plan

  • melos run analyze — no issues
  • flutter test in packages/stream_feeds — all 392 tests pass
  • Docs snippet in docs/code_snippets/06_03_comments.dart (new restrictReplies() function) compiles cleanly

Closes FLU-356

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added activity reply/comment restriction controls via a new restrictReplies setting (everyone, nobody, followers-only).
    • The restriction is now supported end-to-end when creating activities and is surfaced in returned activity/feed data.
  • Documentation
    • Updated the changelog and added an example for posting an activity and handling restrictReplies from the resulting feed state.
  • Tests
    • Added/updated unit test coverage to verify request forwarding and client-side state hydration of restrictReplies.

…Request (FLU-356)

Surface the comment-reply restriction field on the domain model and request
so integrators can set and read who is allowed to comment on an activity.
Adds ActivityRestrictReplies extension type and maps it from ActivityResponse.

Closes FLU-356

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@renefloor renefloor requested a review from a team as a code owner June 17, 2026 12:40
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@renefloor, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 32 minutes and 5 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f773e564-8c46-493d-a3bc-c0e95d24b48f

📥 Commits

Reviewing files that changed from the base of the PR and between 5492e97 and e52df47.

📒 Files selected for processing (6)
  • docs/code_snippets/06_03_comments.dart
  • packages/stream_feeds/CHANGELOG.md
  • packages/stream_feeds/lib/src/state/query/feed_query.dart
  • packages/stream_feeds/lib/src/state/query/feed_query.freezed.dart
  • packages/stream_feeds/test/models/feed_add_activity_request_test.dart
  • packages/stream_feeds/test/state/feed_test.dart
📝 Walkthrough

Walkthrough

Adds reply restriction support to activities in the Stream Feeds Flutter SDK. A new ActivityRestrictReplies extension type is introduced with everyone, nobody, peopleIFollow, and unknown values. The restrictReplies field is added to ActivityData (with response mapping) and as an optional field on FeedAddActivityRequest (propagated to the backend request). Generated Freezed code for both models is updated accordingly. Tests verify the field behavior and state hydration, a test helper is updated to support parameterized scenarios, and a usage example demonstrates the feature with a changelog entry.

Changes

Reply Restriction Support

Layer / File(s) Summary
ActivityRestrictReplies domain type and ActivityData field
packages/stream_feeds/lib/src/models/activity_data.dart, packages/stream_feeds/lib/src/models/activity_data.freezed.dart
Introduces ActivityRestrictReplies extension type with four string values (everyone, nobody, peopleIFollow, unknown) and ActivityResponseRestrictRepliesMapper.toModel(). Adds restrictReplies field to ActivityData constructor, declaration, and toModel() mapping. Updates generated Freezed code to include getter, extend equality/hashCode/toString comparisons, and wire copyWith.
FeedAddActivityRequest restrictReplies field
packages/stream_feeds/lib/src/models/request/feed_add_activity_request.dart, packages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dart
Adds optional AddActivityRequestRestrictReplies? parameter and field to FeedAddActivityRequest, propagates it in toRequest() to the backend, and updates the generated Freezed model for equality, hashCode, toString, and copyWith.
Tests and test helper support
packages/stream_feeds/test/models/activity_data_test.dart, packages/stream_feeds/test/state/feed_test.dart, packages/stream_feeds_test/lib/src/helpers/test_data.dart
Adds unit tests for FeedAddActivityRequest field behavior and verifies restrictReplies is forwarded to the backend API. Adds integration tests for getOrCreate() populating Activity.restrictReplies in feed state. Updates createDefaultActivityResponse test helper to accept optional restrictReplies parameter with everyone default.
Usage example and changelog
docs/code_snippets/06_03_comments.dart, packages/stream_feeds/CHANGELOG.md
Adds restrictReplies() example function demonstrating activity creation with peopleIFollow restriction, reading back the restriction type via switch statement, and checking ownFollowings to determine commenting eligibility. Documents both new fields in the changelog.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • xsahil03x

Poem

🐇 Hop hop, who may speak today?
The rabbit checks ownFollowings array!
peopleIFollow, nobody, everyone too —
Now replies are gated, just as brand new.
The Freezed code hummed, the mapper did map,
And the bunny approved with a satisfied tap! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: exposing restrictReplies on ActivityData and FeedAddActivityRequest, which aligns with the core objectives of this PR.
Description check ✅ Passed The description includes a summary of changes, references the related feature ticket (FLU-356), provides a test plan with verification steps, and notes dependencies on prior work. However, it is missing the CLA checkbox, internal ticket closure information, and the screenshots/videos section from the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch renefloor/flu-356-integrate-comment-replies-restriction-feature-in-api

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/code_snippets/06_03_comments.dart`:
- Around line 148-151: After calling await feed.getOrCreate(), the currentFeed
is being read from the stale pre-refresh activity object instead of the
refreshed state. Re-read the activity from feed.state after the await
feed.getOrCreate() call completes, and use this refreshed activity object to
access currentFeed and ownFollowings for computing canComment, ensuring you are
using the updated data rather than stale values from before the refresh.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 544f8ca1-ed2e-484c-b9ef-760d58789f6b

📥 Commits

Reviewing files that changed from the base of the PR and between a1590dd and de7a4d7.

📒 Files selected for processing (6)
  • docs/code_snippets/06_03_comments.dart
  • packages/stream_feeds/CHANGELOG.md
  • packages/stream_feeds/lib/src/models/activity_data.dart
  • packages/stream_feeds/lib/src/models/activity_data.freezed.dart
  • packages/stream_feeds/lib/src/models/request/feed_add_activity_request.dart
  • packages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dart

Comment thread docs/code_snippets/06_03_comments.dart Outdated
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.51%. Comparing base (a1590dd) to head (e52df47).

Files with missing lines Patch % Lines
...ges/stream_feeds/lib/src/models/activity_data.dart 66.66% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (75.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
- Coverage   85.53%   85.51%   -0.02%     
==========================================
  Files         124      124              
  Lines        4342     4350       +8     
==========================================
+ Hits         3714     3720       +6     
- Misses        628      630       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

renefloor and others added 5 commits June 18, 2026 10:19
Add unit tests for ActivityResponseRestrictRepliesMapper.toModel(),
ActivityResponseMapper restrictReplies field, and FeedAddActivityRequest.restrictReplies.
Also adds restrictReplies param to createDefaultActivityResponse test helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reads currentFeed from the re-fetched activity so that ownFollowings
reflects the latest state rather than the stale pre-refresh object.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant