Skip to content

feat(llc, ui): Add handling of the CreateMention permission#2769

Open
VelikovPetar wants to merge 1 commit into
masterfrom
feature/FLU-532_create_mention_capability_handling
Open

feat(llc, ui): Add handling of the CreateMention permission#2769
VelikovPetar wants to merge 1 commit into
masterfrom
feature/FLU-532_create_mention_capability_handling

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Submit a pull request

Linear: FLU-532

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

Hides the user mentions suggestions if the create-mention capability is not present for the current user in the channel

Summary by CodeRabbit

  • New Features

    • Added channel-level capability for creating mentions
    • Mention autocomplete now respects creation permissions and skips loading user suggestions when the capability is unavailable
  • Tests

    • Added test coverage for mention creation capability checks

@VelikovPetar VelikovPetar marked this pull request as ready for review June 19, 2026 07:24
@VelikovPetar VelikovPetar requested a review from a team June 19, 2026 07:24
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2f2fbebc-1a35-4cfe-8650-ba5d383fb49c

📥 Commits

Reviewing files that changed from the base of the PR and between 4bcd15b and 5c43b75.

📒 Files selected for processing (7)
  • packages/stream_chat/CHANGELOG.md
  • packages/stream_chat/lib/src/client/channel.dart
  • packages/stream_chat/lib/src/core/models/channel_model.dart
  • packages/stream_chat/test/src/client/channel_test.dart
  • packages/stream_chat_flutter/CHANGELOG.md
  • packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart
  • packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart

📝 Walkthrough

Walkthrough

Adds a new ChannelCapability.createMention constant ('create-mention') and a corresponding canCreateMention getter on the ChannelCapabilityCheck extension. StreamMentionAutocompleteOptions._fetchUsers now returns empty results immediately when that capability is absent, preventing queryMembers/queryUsers calls.

Changes

createMention capability and autocomplete guard

Layer / File(s) Summary
ChannelCapability.createMention constant and canCreateMention getter
packages/stream_chat/lib/src/core/models/channel_model.dart, packages/stream_chat/lib/src/client/channel.dart, packages/stream_chat/test/src/client/channel_test.dart, packages/stream_chat/CHANGELOG.md
Adds createMention static constant with value 'create-mention' to ChannelCapability, adds canCreateMention getter to ChannelCapabilityCheck extension, tests absent/present scenarios, and documents the addition.
Mention autocomplete capability guard and test updates
packages/stream_chat_flutter/lib/src/autocomplete/stream_mention_autocomplete_options.dart, packages/stream_chat_flutter/test/src/autocomplete/stream_mention_autocomplete_options_test.dart, packages/stream_chat_flutter/CHANGELOG.md
Adds early-return in _fetchUsers when canCreateMention is false, adds a new no-query test for the missing capability case, and updates all existing mention autocomplete mocks to include ChannelCapability.createMention.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A mention requires a key,
create-mention sets the queries free.
Without the cap, the fetch returns bare—
No queryMembers called with flair!
The bunny hops with glee to say:
Permissions guard the mention way. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and accurately summarizes the main change: adding handling for the CreateMention permission across the low-level client (llc) and UI components.
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 feature/FLU-532_create_mention_capability_handling

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.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.17%. Comparing base (4bcd15b) to head (5c43b75).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2769   +/-   ##
=======================================
  Coverage   69.17%   69.17%           
=======================================
  Files         422      422           
  Lines       25528    25531    +3     
=======================================
+ Hits        17658    17661    +3     
  Misses       7870     7870           

☔ 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.

@VelikovPetar

Copy link
Copy Markdown
Contributor Author

Note: Not merging until we agree to publish this across all SDKs.

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.

2 participants