Skip to content

MM-61199: Replace ChannelBookmarks feature flag with min server version check#9911

Open
calebroseland wants to merge 3 commits into
mainfrom
MM-61199-remove-channelbookmarks-ff
Open

MM-61199: Replace ChannelBookmarks feature flag with min server version check#9911
calebroseland wants to merge 3 commits into
mainfrom
MM-61199-remove-channelbookmarks-ff

Conversation

@calebroseland

@calebroseland calebroseland commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

ChannelBookmarks feature flag was removed, mobile was reading this key via observeConfigBooleanValue — when the key is absent, WatermelonDB returns false, hiding bookmarks on all servers running mattermost/mattermost#37120.

mattermost/mattermost#37368 restores channel bookmarks functionality on mobile for versions before this PR.

Replace the feature flag dependency with isMinimumServerVersion(v, 10, 1, 0), which reflects when the feature was first enabled by default. The check lives in a new observeIsChannelBookmarksEnabled observable in features.ts (alongside the existing observeHasGMasDMFeature pattern), and also gates on license so the UI stays consistent with the fetch path.

See also MM-69705 for a pre-existing related gap surfaced during review.

Ticket Link

https://mattermost.atlassian.net/browse/MM-61199
https://mattermost.atlassian.net/browse/MM-69705

Checklist

  • Added or updated unit tests (required for all new features)
  • Has UI changes
  • Includes text changes and localization file updates

Device Information

N/A — logic change only, no UI changes.

Screenshots

N/A

Release Note

Fixed channel bookmarks being hidden when connected to servers running v10.5 or later.

…rsion

ChannelBookmarks FF was removed from the server (GA in v10.1). Replace the
observeConfigBooleanValue('FeatureFlagChannelBookmarks') check with an
isMinimumServerVersion(v, 10, 1, 0) check so bookmarks work on v10.1+
servers regardless of the FF field being present.

MM-61199
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR replaces the FeatureFlagChannelBookmarks gate with a server-version and licence-based check using CHANNEL_BOOKMARKS_VERSION and a new shared observable. The channel bookmarks action, server feature query, and three channel screens now derive enablement from server version plus licence state.

Changes

Channel Bookmarks Version Gating

Layer / File(s) Summary
New version constant
app/constants/versions.ts
Adds CHANNEL_BOOKMARKS_VERSION = [10, 1, 0].
fetchChannelBookmarks version/license gating
app/actions/remote/channel_bookmark.ts, app/actions/remote/channel_bookmark.test.ts
Replaces the feature-flag check with server version and licence checks, returning empty bookmarks when the server version is below minimum or the licence is inactive; tests now cover the old-server-version path and verify the client call is skipped.
observeIsChannelBookmarksEnabled helper
app/queries/servers/features.ts
Adds an exported observable that combines server Version and licence state to emit whether channel bookmarks are enabled.
Wire new observable into channel screens
app/screens/channel/header/index.ts, app/screens/channel/index.tsx, app/screens/channel_info/index.ts
Replaces observeConfigBooleanValue(database, 'FeatureFlagChannelBookmarks') with observeIsChannelBookmarksEnabled(database) in the channel header, channel screen, and channel info screen.

Estimated code review effort: 2 (Simple) | ~12 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant fetchChannelBookmarks
  participant ServerDB
  ServerDB->>fetchChannelBookmarks: Version, License
  fetchChannelBookmarks->>fetchChannelBookmarks: isMinimumServerVersion(Version, CHANNEL_BOOKMARKS_VERSION)
  alt version too old or license inactive
    fetchChannelBookmarks-->>Caller: {bookmarks: []}
  else version ok and licensed
    fetchChannelBookmarks->>Caller: getChannelBookmarksForChannel result
  end
Loading

Related issues: None specified.
Related PRs: None specified.
Suggested labels: 3: QA Review
Suggested reviewers: None specified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title accurately summarizes the main change: replacing the ChannelBookmarks feature flag with a minimum server version check.
Description check ✅ Passed The description clearly matches the implemented changes and surrounding rationale, including the version gate, license check, and tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MM-61199-remove-channelbookmarks-ff

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
app/actions/remote/channel_bookmark.ts (1)

21-24: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Parallelize the independent DB reads.

getConfigValue and getLicense are independent lookups but are awaited sequentially, adding unnecessary latency to a fetch action called on channel load.

♻️ Proposed fix
-        const serverVersion = await getConfigValue(database, 'Version');
-        const isLicensed = (await getLicense(database))?.IsLicensed === 'true';
+        const [serverVersion, license] = await Promise.all([
+            getConfigValue(database, 'Version'),
+            getLicense(database),
+        ]);
+        const isLicensed = license?.IsLicensed === 'true';
🤖 Prompt for 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.

In `@app/actions/remote/channel_bookmark.ts` around lines 21 - 24, The channel
bookmark fetch action is doing two independent database reads sequentially,
which adds avoidable latency on load. In the action that reads server version
and license status, fetch both values concurrently instead of awaiting one
before starting the other, then keep the existing version/license gate logic
unchanged. Use the existing getConfigValue and getLicense calls in the channel
bookmark flow to locate the code.
🤖 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 `@app/queries/servers/features.ts`:
- Around line 19-24: `observeIsChannelBookmarksEnabled` currently gates
bookmarks only on `Version`, which can make the UI show bookmark features even
when `fetchChannelBookmarks` would later return nothing on unlicensed servers.
Update this observable to also check `getLicense` from the same `Database`, and
combine that license gate with the existing `isMinimumServerVersion` check in
the `observeIsChannelBookmarksEnabled` pipeline so the header/info screens stay
consistent with the fetch path.

---

Nitpick comments:
In `@app/actions/remote/channel_bookmark.ts`:
- Around line 21-24: The channel bookmark fetch action is doing two independent
database reads sequentially, which adds avoidable latency on load. In the action
that reads server version and license status, fetch both values concurrently
instead of awaiting one before starting the other, then keep the existing
version/license gate logic unchanged. Use the existing getConfigValue and
getLicense calls in the channel bookmark flow to locate the code.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bcb3f847-f064-40d7-8366-60520ce4a37b

📥 Commits

Reviewing files that changed from the base of the PR and between 5129a50 and 2e1f805.

📒 Files selected for processing (7)
  • app/actions/remote/channel_bookmark.test.ts
  • app/actions/remote/channel_bookmark.ts
  • app/constants/versions.ts
  • app/queries/servers/features.ts
  • app/screens/channel/header/index.ts
  • app/screens/channel/index.tsx
  • app/screens/channel_info/index.ts

Comment thread app/queries/servers/features.ts
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Coverage Comparison Report

Generated on July 07, 2026 at 21:13:11 UTC

+-----------------+------------+------------+-----------+
| Metric          | Main       | This PR    | Diff      |
+-----------------+------------+------------+-----------+
| Lines           |     87.75% |     87.75% |     0.00% |
| Statements      |     87.61% |     87.62% |     0.01% |
| Branches        |     76.47% |     76.47% |     0.00% |
| Functions       |     87.22% |     87.23% |     0.01% |
+-----------------+------------+------------+-----------+
| Total           |     84.76% |     84.76% |     0.00% |
+-----------------+------------+------------+-----------+

…arksEnabled

Ensures the observable is consistent with the fetchChannelBookmarks guard —
unlicensed servers correctly suppress bookmark UI, not just the network call.

MM-69705
@mattermost-build mattermost-build added E2E/Run Triggers E2E tests on both iOS and Android via Matterwick and removed E2E/Run Triggers E2E tests on both iOS and Android via Matterwick labels Jul 6, 2026
@calebroseland calebroseland added E2E/Run Triggers E2E tests on both iOS and Android via Matterwick 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Jul 6, 2026
@calebroseland calebroseland changed the title [MM-61199] Replace ChannelBookmarks feature flag with min server version check MM-61199: Replace ChannelBookmarks feature flag with min server version check Jul 6, 2026
@mattermost-build mattermost-build removed the E2E/Run Triggers E2E tests on both iOS and Android via Matterwick label Jul 6, 2026
@calebroseland
calebroseland requested review from enahum and lindy65 July 6, 2026 22:34
@amyblais amyblais added this to the v2.43.0 milestone Jul 7, 2026
@amyblais amyblais removed the 2: Dev Review Requires review by a core commiter label Jul 7, 2026
@lindy65 lindy65 added Build Apps for PR Build the mobile app for iOS and Android to test Build App for Android Build the mobile app for Android and removed Build Apps for PR Build the mobile app for iOS and Android to test labels Jul 7, 2026
@lindy65

lindy65 commented Jul 7, 2026

Copy link
Copy Markdown

Hi @calebroseland - I built the apps for this PR but when trying to download the .apk on my Android, it goes through the motions of downloading but then disappears from my downloads folder. Not sure if I'm having an issue because there's a failing check on the PR? Could you take a look please? The .apk built is here on community but I just can't get it to download on my phone.

I removed the build apps for PR label and then just built the Android .apk but I can't get it downloaded onto my phone either. I haven't seen this behavior before :(

@mattermost-build mattermost-build added E2E/Run Triggers E2E tests on both iOS and Android via Matterwick and removed E2E/Run Triggers E2E tests on both iOS and Android via Matterwick labels Jul 7, 2026
@lindy65 lindy65 added Build App for Android Build the mobile app for Android and removed Build App for Android Build the mobile app for Android labels Jul 8, 2026

@lindy65 lindy65 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.

Thanks @calebroseland - finally managed to sort out the .apk install issues!

Tested as per Jira tickets and both are working as expected 👍

@lindy65 lindy65 removed the 3: QA Review Requires review by a QA tester label Jul 8, 2026
@lindy65 lindy65 added 4: Reviews Complete All reviewers have approved the pull request QA Review Done and removed Build App for Android Build the mobile app for Android labels Jul 8, 2026
@enahum

enahum commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Before merging, @calebroseland can you look into #9916 ? seems to be addressing the same problem but a little bit different

@lieut-data

lieut-data commented Jul 9, 2026

Copy link
Copy Markdown
Member

Ah, didn't realize you were looking at this as well, @calebroseland! (Or more likely, I just forgot ;p)

My original approach also used the version it first defaulted true, but then I realized that a later server might also override the feature flag back off. So instead I'm anchoring it to the server version in which the feature flag was removed.

I've also added a framework to help us manage this going forward, as I need to do the same for another flag.

Thoughts?

@calebroseland

Copy link
Copy Markdown
Member Author

Ah, didn't realize you were looking at this as well, @calebroseland! (Or more likely, I just forgot ;p)

My original approach also used the version it first defaulted true, but then I realized that a later server might also override the feature flag back off. So instead I'm anchoring it to the server version in which the feature flag was removed.

I've also added a framework to help us manage this going forward, as I need to do the same for another flag.

Thoughts?

@lieut-data all good, I was actually wondering if having a pre/post version boundary was the right direction, so I'm happy to defer to https://github.com/mattermost/mattermost-mobile/pull/9916—it's the better fix!

My only ask is if you might be able to bring over the quick-fix for https://mattermost.atlassian.net/browse/MM-69705.
https://github.com/mattermost/mattermost-mobile/pull/9911/changes#diff-3adf3e4a385bb5ea083f54d2768d56e28debb39cb1adc93d157b4441fb4ff843R244 (with special note that observeIsChannelBookmarksEnabled includes a license check in this PR)

@lieut-data

Copy link
Copy Markdown
Member

My only ask is if you might be able to bring over the quick-fix for https://mattermost.atlassian.net/browse/MM-69705. https://github.com/mattermost/mattermost-mobile/pull/9911/changes#diff-3adf3e4a385bb5ea083f54d2768d56e28debb39cb1adc93d157b4441fb4ff843R244 (with special note that observeIsChannelBookmarksEnabled includes a license check in this PR)

Absolutely! I've pushed these changes to #9911, with an other addition to make the aysnc fetch and observable both inline the license checks.

Are we ok to close this PR in favour of #9916?

@amyblais amyblais added the CherryPick/Approved Meant for the quality or patch release tracked in the milestone label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4: Reviews Complete All reviewers have approved the pull request CherryPick/Approved Meant for the quality or patch release tracked in the milestone QA Review Done release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants