-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Input upload disabled based on channel config #585
Conversation
} | ||
maxNumberOfFiles={messageInput.maxFilesLeft} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EditMessageForm changed regarding max attachments was missing from #577
Size Change: +206 B (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
@@ -687,8 +687,11 @@ export default function useMessageInputState(props) { | |||
|
|||
const maxFilesLeft = maxFilesAllowed - numberOfUploads; | |||
|
|||
const isUploadEnabled = channel?.getConfig?.()?.uploads !== false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small suggestion, as I think this line is a little bit tricky to read. Feel free to ignore it.
const isUploadEnabled = channel?.getConfig?.()?.uploads !== false; | |
const uploadConfig = channel?.getConfig?.()?.uploads; | |
const isUploadEnabled = typeof uploadConfig === 'undefined' || uploadConfig === true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or it could be null as well 😅 maybe just adding a comment would do, so we're sure the undefined|null !== false was intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, this is easier to read, but there are few more instances of channel?.getConfig?.().X !== false
for other properties across the codebase, so let's keep this one similar to them. we can simplify them all together later
No description provided.