Chats: gate upload button behind chatsMedia
feature flag
This commit is contained in:
parent
4c5e8eb525
commit
9e39415ca8
2 changed files with 19 additions and 10 deletions
|
@ -7,7 +7,7 @@ import { Button, Combobox, ComboboxInput, ComboboxList, ComboboxOption, Combobox
|
||||||
import { useChatContext } from 'soapbox/contexts/chat-context';
|
import { useChatContext } from 'soapbox/contexts/chat-context';
|
||||||
import UploadButton from 'soapbox/features/compose/components/upload-button';
|
import UploadButton from 'soapbox/features/compose/components/upload-button';
|
||||||
import { search as emojiSearch } from 'soapbox/features/emoji/emoji-mart-search-light';
|
import { search as emojiSearch } from 'soapbox/features/emoji/emoji-mart-search-light';
|
||||||
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector, useFeatures } from 'soapbox/hooks';
|
||||||
import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions';
|
import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
@ -55,8 +55,9 @@ const ChatComposer = React.forwardRef<HTMLTextAreaElement | null, IChatComposer>
|
||||||
onPaste,
|
onPaste,
|
||||||
hasAttachment,
|
hasAttachment,
|
||||||
}, ref) => {
|
}, ref) => {
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
const features = useFeatures();
|
||||||
|
|
||||||
const { chat } = useChatContext();
|
const { chat } = useChatContext();
|
||||||
|
|
||||||
|
@ -151,6 +152,7 @@ const ChatComposer = React.forwardRef<HTMLTextAreaElement | null, IChatComposer>
|
||||||
return (
|
return (
|
||||||
<div className='mt-auto px-4 shadow-3xl'>
|
<div className='mt-auto px-4 shadow-3xl'>
|
||||||
<HStack alignItems='stretch' justifyContent='between' space={4}>
|
<HStack alignItems='stretch' justifyContent='between' space={4}>
|
||||||
|
{features.chatsMedia && (
|
||||||
<Stack justifyContent='end' alignItems='center' className='w-10 mb-1.5'>
|
<Stack justifyContent='end' alignItems='center' className='w-10 mb-1.5'>
|
||||||
<UploadButton
|
<UploadButton
|
||||||
onSelectFile={onSelectFile}
|
onSelectFile={onSelectFile}
|
||||||
|
@ -159,6 +161,7 @@ const ChatComposer = React.forwardRef<HTMLTextAreaElement | null, IChatComposer>
|
||||||
className='text-primary-500'
|
className='text-primary-500'
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
)}
|
||||||
|
|
||||||
<Stack grow>
|
<Stack grow>
|
||||||
<Combobox
|
<Combobox
|
||||||
|
|
|
@ -232,6 +232,12 @@ const getInstanceFeatures = (instance: Instance) => {
|
||||||
*/
|
*/
|
||||||
chatsExpiration: v.software === TRUTHSOCIAL,
|
chatsExpiration: v.software === TRUTHSOCIAL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether chat messages can accept a `media_id` attachment.
|
||||||
|
* @see POST /api/v1/pleroma/chats/:id/messages
|
||||||
|
*/
|
||||||
|
chatsMedia: v.software !== TRUTHSOCIAL,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ability to search among chats.
|
* Ability to search among chats.
|
||||||
* @see GET /api/v1/pleroma/chats
|
* @see GET /api/v1/pleroma/chats
|
||||||
|
|
Loading…
Reference in a new issue