Chats: search accounts only among people who follow you (TruthSocial)

This commit is contained in:
Alex Gleason 2022-10-17 10:13:54 -05:00
parent 1ab7591b36
commit 82250c23dc
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 7 additions and 2 deletions

View file

@ -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. */

View file

@ -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<IAutosuggestAccountInput> = ({
@ -29,6 +31,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
onSelected,
value = '',
limit = 4,
followers = false,
...rest
}) => {
const dispatch = useAppDispatch();
@ -45,7 +48,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
};
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 }[]) => {

View file

@ -39,6 +39,7 @@ const ChatPageNew: React.FC<IChatPageNew> = () => {
showButtons={false}
autoFocus
className='mb-0.5'
followers
/>
</HStack>
</Stack>