From 82250c23dc7854cbf5b1c21f68288192c7653bf6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 17 Oct 2022 10:13:54 -0500 Subject: [PATCH] Chats: search accounts only among people who follow you (TruthSocial) --- app/soapbox/components/account_search.tsx | 3 ++- app/soapbox/components/autosuggest_account_input.tsx | 5 ++++- .../chats/components/chat-page/components/chat-page-new.tsx | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/soapbox/components/account_search.tsx b/app/soapbox/components/account_search.tsx index cdc526b9ba..dad699f0db 100644 --- a/app/soapbox/components/account_search.tsx +++ b/app/soapbox/components/account_search.tsx @@ -3,7 +3,6 @@ import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import AutosuggestAccountInput from 'soapbox/components/autosuggest_account_input'; -import Icon from 'soapbox/components/icon'; import SvgIcon from './ui/icon/svg-icon'; import { InputThemes } from './ui/input/input'; @@ -25,6 +24,8 @@ interface IAccountSearch { hidePortal?: boolean, theme?: InputThemes, showButtons?: boolean, + /** Search only among people who follow you (TruthSocial). */ + followers?: boolean, } /** Input to search for accounts. */ diff --git a/app/soapbox/components/autosuggest_account_input.tsx b/app/soapbox/components/autosuggest_account_input.tsx index f7dc890cd0..a69b449c7d 100644 --- a/app/soapbox/components/autosuggest_account_input.tsx +++ b/app/soapbox/components/autosuggest_account_input.tsx @@ -22,6 +22,8 @@ interface IAutosuggestAccountInput { menu?: Menu, onKeyDown?: React.KeyboardEventHandler, theme?: InputThemes, + /** Search only among people who follow you (TruthSocial). */ + followers?: boolean, } const AutosuggestAccountInput: React.FC = ({ @@ -29,6 +31,7 @@ const AutosuggestAccountInput: React.FC = ({ onSelected, value = '', limit = 4, + followers = false, ...rest }) => { const dispatch = useAppDispatch(); @@ -45,7 +48,7 @@ const AutosuggestAccountInput: React.FC = ({ }; const handleAccountSearch = useCallback(throttle(q => { - const params = { q, limit, resolve: false }; + const params = { q, limit, followers, resolve: false }; dispatch(accountSearch(params, controller.current.signal)) .then((accounts: { id: string }[]) => { diff --git a/app/soapbox/features/chats/components/chat-page/components/chat-page-new.tsx b/app/soapbox/features/chats/components/chat-page/components/chat-page-new.tsx index 3251dea966..62dda22dd6 100644 --- a/app/soapbox/features/chats/components/chat-page/components/chat-page-new.tsx +++ b/app/soapbox/features/chats/components/chat-page/components/chat-page-new.tsx @@ -39,6 +39,7 @@ const ChatPageNew: React.FC = () => { showButtons={false} autoFocus className='mb-0.5' + followers />