feat: hide message history for users who joined after messages were posted #1

Open
Ben wants to merge 9 commits from feat/hide-message-history into master
Owner

Summary

When enabled via the HideMessageHistory feature flag, users cannot see channel messages posted before their channel join date.

  • Feature flag: HideMessageHistory (default: false)
  • Exempt users setting: MattermostExtendedSettings.Posts.HideMessageHistoryExemptUsers (comma-separated usernames)
  • JoinedAt field: New int64 field on ChannelMember, set on creation via PreSave(). Existing members get JoinedAt=0 (full access).
  • Post filtering: filterPostsByMemberJoinDate() runs after filterInaccessiblePosts() in all 12 post-fetching paths
  • Admin UI: Toggle on Features page + exempt users text field in Posts settings (visible only when flag enabled)
  • Migration: 000149_add_joinedat_to_channelmembers adds JoinedAt BIGINT DEFAULT 0

Test plan

  • Enable HideMessageHistory flag, verify new channel members can't see pre-join messages
  • Verify pre-existing members (JoinedAt=0) retain full access
  • Verify exempt users see all messages
  • Verify search results are also filtered
  • Verify flagged posts across channels are filtered per-channel
  • Run Go test suite (TestFilterPostsByMemberJoinDate)
## Summary When enabled via the `HideMessageHistory` feature flag, users cannot see channel messages posted before their channel join date. - **Feature flag**: `HideMessageHistory` (default: false) - **Exempt users setting**: `MattermostExtendedSettings.Posts.HideMessageHistoryExemptUsers` (comma-separated usernames) - **JoinedAt field**: New `int64` field on `ChannelMember`, set on creation via `PreSave()`. Existing members get `JoinedAt=0` (full access). - **Post filtering**: `filterPostsByMemberJoinDate()` runs after `filterInaccessiblePosts()` in all 12 post-fetching paths - **Admin UI**: Toggle on Features page + exempt users text field in Posts settings (visible only when flag enabled) - **Migration**: `000149_add_joinedat_to_channelmembers` adds `JoinedAt BIGINT DEFAULT 0` ## Test plan - [ ] Enable HideMessageHistory flag, verify new channel members can't see pre-join messages - [ ] Verify pre-existing members (JoinedAt=0) retain full access - [ ] Verify exempt users see all messages - [ ] Verify search results are also filtered - [ ] Verify flagged posts across channels are filtered per-channel - [ ] Run Go test suite (TestFilterPostsByMemberJoinDate)
Ben changed target branch from fix/status-offline-to-dnd to master 2026-02-14 15:30:40 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/hide-message-history:feat/hide-message-history
git switch feat/hide-message-history

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff feat/hide-message-history
git switch feat/hide-message-history
git rebase master
git switch master
git merge --ff-only feat/hide-message-history
git switch feat/hide-message-history
git rebase master
git switch master
git merge --no-ff feat/hide-message-history
git switch master
git merge --squash feat/hide-message-history
git switch master
git merge --ff-only feat/hide-message-history
git switch master
git merge feat/hide-message-history
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Ben/mattermost-extended!1
No description provided.