Skip to content
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

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

mahboubii
Copy link
Contributor

No description provided.

@mahboubii mahboubii added the enhancement New feature or request label Oct 19, 2020
}
maxNumberOfFiles={messageInput.maxFilesLeft}
Copy link
Contributor Author

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

@github-actions
Copy link

Size Change: +206 B (0%)

Total Size: 1.26 MB

Filename Size Change
./dist/browser.full-bundle.js 644 kB +55 B (0%)
./dist/browser.full-bundle.min.js 372 kB +42 B (0%)
./dist/index.es.js 105 kB +58 B (0%)
./dist/index.js 107 kB +51 B (0%)
ℹ️ View Unchanged
Filename Size Change
./dist/css/index.css 23 kB 0 B
./dist/css/index.js 21 B 0 B
./dist/i18n/en.json 824 B 0 B
./dist/i18n/fr.json 1.25 kB 0 B
./dist/i18n/hi.json 1.43 kB 0 B
./dist/i18n/it.json 1.19 kB 0 B
./dist/i18n/nl.json 1.17 kB 0 B
./dist/i18n/ru.json 1.47 kB 0 B
./dist/i18n/tr.json 1.19 kB 0 B

compressed-size-action

@@ -687,8 +687,11 @@ export default function useMessageInputState(props) {

const maxFilesLeft = maxFilesAllowed - numberOfUploads;

const isUploadEnabled = channel?.getConfig?.()?.uploads !== false;
Copy link
Contributor

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.

Suggested change
const isUploadEnabled = channel?.getConfig?.()?.uploads !== false;
const uploadConfig = channel?.getConfig?.()?.uploads;
const isUploadEnabled = typeof uploadConfig === 'undefined' || uploadConfig === true;

Copy link
Contributor

@vini-btc vini-btc Oct 19, 2020

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.

Copy link
Contributor Author

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

@mahboubii mahboubii merged commit f98bde9 into master Oct 19, 2020
@delete-merged-branch delete-merged-branch bot deleted the feature/input-upload-channel-config branch October 19, 2020 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants