[IMPROVE] Message rewrite code structure#24723
Merged
gabriellsh merged 3 commits intomessage-template-2from Mar 7, 2022
Merged
[IMPROVE] Message rewrite code structure#24723gabriellsh merged 3 commits intomessage-template-2from
gabriellsh merged 3 commits intomessage-template-2from
Conversation
018de3f to
bf6651f
Compare
filipemarins
reviewed
Mar 7, 2022
Comment on lines
+61
to
+63
| const isEncryptedMessage = isE2EEMessage(message); | ||
| const encryptedMessageIsPending = isEncryptedMessage && message.e2e === 'pending'; | ||
| const messageIsReady = !isEncryptedMessage || !encryptedMessageIsPending; |
Contributor
There was a problem hiding this comment.
Suggested change
| const isEncryptedMessage = isE2EEMessage(message); | |
| const encryptedMessageIsPending = isEncryptedMessage && message.e2e === 'pending'; | |
| const messageIsReady = !isEncryptedMessage || !encryptedMessageIsPending; | |
| const isEncryptedMessage = isE2EEMessage(message); | |
| const isEncryptedMessagePending = isEncryptedMessage && message.e2e === 'pending'; | |
| const isMessageReady = !isEncryptedMessage || !encryptedMessageIsPending; |
I believe when the variable is boolean it is good to put the prefix is.
filipemarins
reviewed
Mar 7, 2022
Comment on lines
+14
to
+16
| if (!message.reactions || !Object.keys(message.reactions).length) { | ||
| return null; | ||
| } |
Contributor
There was a problem hiding this comment.
This conditional should be on the parent component.
example:
Message.tsx
{Object.keys(message.reactions).length && <MessageReactionsList />}
This way the component will not be loaded.
filipemarins
reviewed
Mar 7, 2022
| <MessageBody> | ||
| {encryptedMessageIsPending && t('E2E_message_encrypted_placeholder')} | ||
|
|
||
| {messageIsReady && !message.blocks && message.md && ( |
Contributor
There was a problem hiding this comment.
maybe some const to this case? like shoudShowMessageRender?
filipemarins
reviewed
Mar 7, 2022
| import { useSetting } from '../../../../contexts/SettingsContext'; | ||
|
|
||
| const MessageReadReceipt = (): ReactElement | null => { | ||
| const isReadReceiptEnabled = useSetting('Message_Read_Receipt_Enabled'); |
Contributor
There was a problem hiding this comment.
Maybe on MessageListProvider? can we centralize the Settings there.
filipemarins
approved these changes
Mar 7, 2022
gabriellsh
added a commit
that referenced
this pull request
Mar 7, 2022
…t into editContext * 'message-template-2' of github.com:RocketChat/Rocket.Chat: (33 commits) [IMPROVE] Message rewrite code structure (#24723) Fix messages being imported without sender's username (#24674) Bump actions/setup-node from 2 to 3 (#24642) i18n: Language update from LingoHub 🤖 on 2022-02-28Z (#24644) [FIX] Duplicated 'name' log key (#24590) Bump actions/checkout from 2 to 3 (#24668) Chore(deps-dev): Bump @types/mock-require from 2.0.0 to 2.0.1 (#24574) Bump ts-node from 10.5.0 to 10.6.0 in /ee/server/services (#24667) Bump @types/ws from 8.2.3 to 8.5.2 in /ee/server/services (#24666) Bump url-parse from 1.5.7 to 1.5.10 (#24640) [FIX] Typo in wrap-up term (#24661) [IMPROVE] Updated links in readme (#24028) Bump version to 4.6.0-develop Bump version to 4.5.0 Bump version to 4.5.0-rc.6 Chore: Update Apps-Engine (#24651) Bump version to 4.5.0-rc.5 Refresh server connection when MI server settings change (#24649) Bump version to 4.5.0-rc.4 Bump version to 4.5.0-rc.3 ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments