Skip to content

Commit

Permalink
fix: only allow search for channels where the user is a member
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkothari22 committed Dec 14, 2024
1 parent 44fae19 commit 6a7ffda
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 139 deletions.
133 changes: 0 additions & 133 deletions frontend/src/components/feature/GlobalSearch/ChannelSearch.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions frontend/src/components/feature/GlobalSearch/GlobalSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ChannelSearch } from "./ChannelSearch"
import { FileSearch } from "./FileSearch"
import { MessageSearch } from "./MessageSearch"
import { Dialog, Flex, Tabs, Box } from "@radix-ui/themes"
Expand Down Expand Up @@ -66,7 +65,6 @@ const GlobalSearchContent = (props: GlobalSearchModalProps) => {
<Tabs.List>
<Tabs.Trigger value="0">Messages</Tabs.Trigger>
<Tabs.Trigger value="1">Files</Tabs.Trigger>
<Tabs.Trigger value="2">Channels</Tabs.Trigger>
</Tabs.List>
<Box pt="3" pb="2">
<Tabs.Content value="0">
Expand All @@ -75,9 +73,6 @@ const GlobalSearchContent = (props: GlobalSearchModalProps) => {
<Tabs.Content value="1">
<FileSearch onToggleMyChannels={onToggleMyChannels} isOnlyInMyChannels={isOnlyInMyChannels} onToggleSaved={onToggleSaved} isSaved={isSaved} input={input} fromFilter={fromFilter} inFilter={inFilter} withFilter={withFilter} />
</Tabs.Content>
<Tabs.Content value="2">
<ChannelSearch onToggleMyChannels={onToggleMyChannels} isOnlyInMyChannels={isOnlyInMyChannels} input={input} onClose={onClose} />
</Tabs.Content>
</Box>
</Tabs.Root>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion raven/api/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def get_search_result(
.on(channel_member.channel_id == message.channel_id)
.join(file_doc, JoinType.left)
.on(message.name == file_doc.attached_to_name)
.where((channel.type != "Private") | (channel_member.user_id == frappe.session.user))
.where(channel_member.user_id == frappe.session.user)
)

if filter_type == "File":
Expand Down

0 comments on commit 6a7ffda

Please sign in to comment.