diff --git a/web/app/components/AppSidebar.nuxt.test.ts b/web/app/components/AppSidebar.nuxt.test.ts index b1f2bd2f..9039c4b0 100644 --- a/web/app/components/AppSidebar.nuxt.test.ts +++ b/web/app/components/AppSidebar.nuxt.test.ts @@ -325,6 +325,20 @@ describe("", { concurrent: false }, () => { ).not.toBeNull() }) + it("leaves the search row out when the server has no search", async ({ + expect, + }) => { + stubQueries() + seedCapabilities({ search: false }) + + const wrapper = await mountSidebar() + + expect(wrapper.text()).not.toContain( + t("sidebar.sections.top.search-button"), + ) + expect(wrapper.text()).toContain(t("sidebar.sections.top.inbox")) + }) + it("asks to toggle the notification sidebar from the inbox row", async ({ expect, }) => { diff --git a/web/app/components/AppSidebar.vue b/web/app/components/AppSidebar.vue index ee678096..9c7b3690 100644 --- a/web/app/components/AppSidebar.vue +++ b/web/app/components/AppSidebar.vue @@ -42,6 +42,7 @@ const { fetchGitHubConnectionStatus, gitHubConfigured, fetchGitHubInstallURL } = useGitHubAPI() const { fetchSlackConnectionStatus, slackConfigured, fetchSlackInstallURL } = useSlackAPI() +const { isSearchEnabled } = useCapabilitiesAPI() const { useFetchNotificationCount } = useNotificationAPI() const fetchNotificationCount = useFetchNotificationCount({ read: false }) const editorStore = useEditorStore() @@ -57,6 +58,10 @@ useShortcut(SHORTCUT_ACTIONS.toggleSidebar.keyboardKey, () => { toggleSidebar() }) useShortcut(SHORTCUT_ACTIONS.searchForDocuments.keyboardKey, () => { + if (!isSearchEnabled.value) { + return + } + isSearchModalOpen.value = !isSearchModalOpen.value }) useShortcut(SHORTCUT_ACTIONS.toggleInbox.keyboardKey, () => { @@ -148,20 +153,6 @@ const sections = computed(() => { } const topSectionItems: SidebarItem[] = [ - { - id: "search-button", - name: t("sidebar.sections.top.search-button"), - icon: "lucide:search", - onClick: () => { - isSearchModalOpen.value = true - }, - acceptsChildren: false, - active: false, - draggable: false, - actions: [], - shortcutTooltip: SHORTCUT_ACTIONS.searchForDocuments, - children: null, - }, { id: "inbox", name: t("sidebar.sections.top.inbox"), @@ -179,6 +170,23 @@ const sections = computed(() => { }, ] + if (isSearchEnabled.value) { + topSectionItems.unshift({ + id: "search-button", + name: t("sidebar.sections.top.search-button"), + icon: "lucide:search", + onClick: () => { + isSearchModalOpen.value = true + }, + acceptsChildren: false, + active: false, + draggable: false, + actions: [], + shortcutTooltip: SHORTCUT_ACTIONS.searchForDocuments, + children: null, + }) + } + topSection.items = topSectionItems const nextStepsItems: SidebarItem[] = [] diff --git a/web/app/components/editor/hooks/HookMenuContent.nuxt.test.ts b/web/app/components/editor/hooks/HookMenuContent.nuxt.test.ts index d1fc96ed..590afc0a 100644 --- a/web/app/components/editor/hooks/HookMenuContent.nuxt.test.ts +++ b/web/app/components/editor/hooks/HookMenuContent.nuxt.test.ts @@ -115,6 +115,22 @@ describe("", { concurrent: false }, () => { expect(menuText()).toContain(t("editor.hooks.time-expiration.title")) }) + it("leaves website changes out when the server has no changedetection", async ({ + expect, + }) => { + mockGitHub(true) + seedCapabilities({ changeDetection: false }) + await mountContent() + + await openHookSubMenu(t(ADD_NEW)) + + await vi.waitFor(() => { + expect(menuText()).toContain(t("editor.hooks.github-tracking.title")) + }, WAIT_FOR_OPTIONS) + expect(menuText()).not.toContain(t("editor.hooks.url-watcher.title")) + expect(menuText()).toContain(t("editor.hooks.time-expiration.title")) + }) + it("lists the hooks already on the block", async ({ expect }) => { mockGitHub(true) diff --git a/web/app/components/editor/hooks/HookMenuContent.vue b/web/app/components/editor/hooks/HookMenuContent.vue index a4b8cec1..ede22e83 100644 --- a/web/app/components/editor/hooks/HookMenuContent.vue +++ b/web/app/components/editor/hooks/HookMenuContent.vue @@ -15,6 +15,7 @@ const emit = defineEmits<{ }>() const { gitHubConfigured } = useGitHubAPI() +const { isChangeDetectionEnabled } = useCapabilitiesAPI() const isSubOpen = ref(false) @@ -142,6 +143,7 @@ function hookProps( @open-settings="(target: 'github') => emit('open-settings', target)" />