Skip to content

Commit

Permalink
assistant builder: do not load slack links when not builder (#3281)
Browse files Browse the repository at this point in the history
* assistant builder: do not load slack links when not builder

* nit
  • Loading branch information
spolu authored Jan 18, 2024
1 parent 3e9364a commit 019eb25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion front/components/assistant_builder/AssistantBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ export default function AssistantBuilder({
useSlackChannelsLinkedWithAgent({
workspaceId: owner.sId,
dataSourceName: slackDataSource?.name ?? undefined,
disabled: !isBuilder(owner),
});
const [slackChannelsInitialized, setSlackChannelsInitialized] =
useState(false);
Expand Down Expand Up @@ -1460,7 +1461,7 @@ function SlackIntegration({
<Button
labelVisible={true}
label={"Select channels"}
variant={"primary"}
variant={"secondary"}
icon={PlusIcon}
onClick={openModal}
/>
Expand Down
4 changes: 3 additions & 1 deletion front/lib/swr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,17 @@ export function useAgentUsage({
export function useSlackChannelsLinkedWithAgent({
workspaceId,
dataSourceName,
disabled,
}: {
workspaceId: string;
dataSourceName?: string;
disabled?: boolean;
}) {
const slackChannelsLinkedWithAgentFetcher: Fetcher<GetSlackChannelsLinkedWithAgentResponseBody> =
fetcher;

const { data, error, mutate } = useSWR(
dataSourceName
dataSourceName && !disabled
? `/api/w/${workspaceId}/data_sources/${dataSourceName}/managed/slack/channels_linked_with_agent`
: null,
slackChannelsLinkedWithAgentFetcher
Expand Down

0 comments on commit 019eb25

Please sign in to comment.