Feature-gate language picker

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-05-18 12:14:41 +02:00
parent 38a3d12e58
commit 0d2b7f026f
2 changed files with 12 additions and 3 deletions

View file

@ -240,9 +240,9 @@ const ComposeForm = <ID extends string>({ id, shouldCondense, autoFocus, clickab
const selectButtons = [];
if (features.privacyScopes && !group && !groupId) selectButtons.push(<PrivacyDropdown composeId={id} />);
if (features.richText) selectButtons.push(<ContentTypeButton composeId={id} />);
selectButtons.push(<LanguageDropdown composeId={id} />);
if (features.privacyScopes && !group && !groupId) selectButtons.push(<PrivacyDropdown key='privacy-dropdown' composeId={id} />);
if (features.richText) selectButtons.push(<ContentTypeButton key='compose-type-button' composeId={id} />);
if (features.postLanguages) selectButtons.push(<LanguageDropdown key='language-dropdown' composeId={id} />);
return (
<Stack className='w-full' space={4} ref={formRef} onClick={handleClick} element='form' onSubmit={handleSubmit}>

View file

@ -673,6 +673,15 @@ const getInstanceFeatures = (instance: Instance) => {
v.software === TAKAHE && gte(v.version, '0.8.0'),
]),
/**
* Can select a language for statuses.
* @see POST /api/v1/statuses
*/
postLanguages: any([
v.software === MASTODON,
v.software === PLEROMA && v.build === REBASED,
]),
/**
* Can set privacy scopes on statuses.
* @see POST /api/v1/statuses