Chats: search accounts only among people who follow you (TruthSocial)
This commit is contained in:
parent
1ab7591b36
commit
82250c23dc
3 changed files with 7 additions and 2 deletions
|
@ -3,7 +3,6 @@ import React, { useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
import AutosuggestAccountInput from 'soapbox/components/autosuggest_account_input';
|
import AutosuggestAccountInput from 'soapbox/components/autosuggest_account_input';
|
||||||
import Icon from 'soapbox/components/icon';
|
|
||||||
|
|
||||||
import SvgIcon from './ui/icon/svg-icon';
|
import SvgIcon from './ui/icon/svg-icon';
|
||||||
import { InputThemes } from './ui/input/input';
|
import { InputThemes } from './ui/input/input';
|
||||||
|
@ -25,6 +24,8 @@ interface IAccountSearch {
|
||||||
hidePortal?: boolean,
|
hidePortal?: boolean,
|
||||||
theme?: InputThemes,
|
theme?: InputThemes,
|
||||||
showButtons?: boolean,
|
showButtons?: boolean,
|
||||||
|
/** Search only among people who follow you (TruthSocial). */
|
||||||
|
followers?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Input to search for accounts. */
|
/** Input to search for accounts. */
|
||||||
|
|
|
@ -22,6 +22,8 @@ interface IAutosuggestAccountInput {
|
||||||
menu?: Menu,
|
menu?: Menu,
|
||||||
onKeyDown?: React.KeyboardEventHandler,
|
onKeyDown?: React.KeyboardEventHandler,
|
||||||
theme?: InputThemes,
|
theme?: InputThemes,
|
||||||
|
/** Search only among people who follow you (TruthSocial). */
|
||||||
|
followers?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
|
const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
|
||||||
|
@ -29,6 +31,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
|
||||||
onSelected,
|
onSelected,
|
||||||
value = '',
|
value = '',
|
||||||
limit = 4,
|
limit = 4,
|
||||||
|
followers = false,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
@ -45,7 +48,7 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAccountSearch = useCallback(throttle(q => {
|
const handleAccountSearch = useCallback(throttle(q => {
|
||||||
const params = { q, limit, resolve: false };
|
const params = { q, limit, followers, resolve: false };
|
||||||
|
|
||||||
dispatch(accountSearch(params, controller.current.signal))
|
dispatch(accountSearch(params, controller.current.signal))
|
||||||
.then((accounts: { id: string }[]) => {
|
.then((accounts: { id: string }[]) => {
|
||||||
|
|
|
@ -39,6 +39,7 @@ const ChatPageNew: React.FC<IChatPageNew> = () => {
|
||||||
showButtons={false}
|
showButtons={false}
|
||||||
autoFocus
|
autoFocus
|
||||||
className='mb-0.5'
|
className='mb-0.5'
|
||||||
|
followers
|
||||||
/>
|
/>
|
||||||
</HStack>
|
</HStack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
Loading…
Reference in a new issue