From 7cf19433649d3176f6335c26d4c899f358a0b5ee Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 22 Sep 2022 16:52:31 -0500 Subject: [PATCH] Add chatsSearch feature --- .../chats/components/chat-pane/chat-pane.tsx | 19 +++++++++++-------- app/soapbox/utils/features.ts | 6 ++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/soapbox/features/chats/components/chat-pane/chat-pane.tsx b/app/soapbox/features/chats/components/chat-pane/chat-pane.tsx index 02d3a0e2b5..9ab8252e06 100644 --- a/app/soapbox/features/chats/components/chat-pane/chat-pane.tsx +++ b/app/soapbox/features/chats/components/chat-pane/chat-pane.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import { Stack } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; -import { useDebounce } from 'soapbox/hooks'; +import { useDebounce, useFeatures } from 'soapbox/hooks'; import { IChat, useChats } from 'soapbox/queries/chats'; import ChatList from '../chat-list'; @@ -17,6 +17,7 @@ import { Pane } from '../ui'; import Blankslate from './blankslate'; const ChatPane = () => { + const features = useFeatures(); const debounce = useDebounce; const [value, setValue] = useState(); @@ -44,13 +45,15 @@ const ChatPane = () => { if (hasSearchValue || Number(chats?.length) > 0) { return ( -
- setValue(event.target.value)} - onClear={clearValue} - /> -
+ {features.chatsSearch && ( +
+ setValue(event.target.value)} + onClear={clearValue} + /> +
+ )} {Number(chats?.length) > 0 ? ( { */ chats: v.software === TRUTHSOCIAL || (v.software === PLEROMA && gte(v.version, '2.1.0')), + /** + * Ability to search among chats. + * @see GET /api/v1/pleroma/chats + */ + chatsSearch: v.software === TRUTHSOCIAL, + /** * Paginated chats API. * @see GET /api/v2/chats