Skip to content

Removed private channels from search - #272

Merged
sfreeman422 merged 1 commit into
masterfrom
feature/remove-private-channels
Jul 30, 2026
Merged

Removed private channels from search#272
sfreeman422 merged 1 commit into
masterfrom
feature/remove-private-channels

Conversation

@sfreeman422

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 29, 2026 23:56

Copilot AI 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.

Pull request overview

This PR changes the backend search behavior for messages by shifting channel filtering responsibility from the controller to the persistence layer and tightening the SQL joins to require a slack_channel match.

Changes:

  • Removed the controller-side filter that previously dropped non-public channel IDs from /messages results.
  • Updated the search SQL to remove the message.channel LIKE 'C%' condition, switch slack_channel from LEFT JOIN to INNER JOIN, and select slack_channel.name directly as channelName.
  • Updated/added unit tests to assert the new SQL join and controller pass-through behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/backend/src/search/search.persistence.service.ts Alters SQL construction for message search (conditions, join type, selected channelName).
packages/backend/src/search/search.persistence.service.spec.ts Updates assertions and adds a test reflecting the new SQL join expectations.
packages/backend/src/search/search.controller.ts Removes controller-side filtering of messages by channel ID prefix.
packages/backend/src/search/search.controller.spec.ts Updates test expectations to match controller pass-through behavior.
Comments suppressed due to low confidence (2)

packages/backend/src/search/search.controller.spec.ts:74

  • This test now asserts that private-channel (G…) and DM (D…) messages are returned unchanged. That contradicts the PR title (“Removed private channels from search”) and removes regression coverage that previously ensured only public channels were returned. Either restore an assertion that only public-channel messages are returned, or update the PR title/requirements to reflect the new behavior.
  it('returns messages exactly as provided by persistence', async () => {
    searchMessagesMock.mockResolvedValue({
      messages: [
        { id: 1, message: 'public', name: 'alice', channel: 'C111' },
        { id: 2, message: 'private', name: 'bob', channel: 'G222' },

packages/backend/src/search/search.persistence.service.spec.ts:97

  • This new test enforces that the query requires a matching slack_channel row via INNER JOIN. That requirement can unintentionally hide valid messages if slack_channel is not fully populated (and it still doesn't guarantee private channels are excluded). If the intent is privacy (exclude G…/D…), add a test that asserts a public-channel filter and consider keeping slack_channel as a LEFT JOIN with COALESCE for resilience.
  it('requires channel to exist in slack_channel via INNER JOIN', async () => {
    query.mockResolvedValueOnce([{ total: 0 }]).mockResolvedValueOnce([]);

    await service.searchMessages({ teamId: 'T1' });


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/backend/src/search/search.persistence.service.ts
Comment thread packages/backend/src/search/search.controller.ts
Comment thread packages/backend/src/search/search.persistence.service.spec.ts
Comment thread packages/backend/src/search/search.persistence.service.ts
@sfreeman422
sfreeman422 merged commit 3264aa6 into master Jul 30, 2026
11 checks passed
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