-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Mobile drafts #8280
base: main
Are you sure you want to change the base?
Mobile drafts #8280
Conversation
/update-branch |
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.
Great work! Some comments.
if (!draft) { | ||
const newDraft: Draft = { | ||
channel_id: channelId, | ||
root_id: rootId, | ||
metadata: { | ||
images: imageMetadata, | ||
}, | ||
update_at: Date.now(), | ||
}; | ||
|
||
return operator.handleDraft({drafts: [newDraft], prepareRecordsOnly}); | ||
} |
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.
I wonder when this scenario happens, and if we really want to create a new draft.
My initial thought is this happens when we receive the metadata either after the draft is sent (and therefore not yet created) or before the draft is created. If it is already sent, we should just ignore. If it hasn't been added, probably this should not have been called.
Is there any other scenario I may be missing?
const isTablet = useIsTablet(); | ||
const showPostPriority = Boolean(isPostPriorityEnabled && draft.metadata?.priority && draft.metadata?.priority?.priority); | ||
|
||
const onLongPress = () => { |
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.
Use useCallback
to avoid passing a new function on every render.
underlayColor={changeOpacity(theme.centerChannelColor, 0.1)} | ||
> | ||
<View | ||
style={[style.container]} |
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.
style={[style.container]} | |
style={style.container} |
postId: of$(draftId), | ||
postProps: of$({}), |
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.
Why are these two needed?
|
||
return { | ||
canDownloadFiles: observeCanDownloadFiles(database), | ||
publicLinkEnabled, |
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.
Why declare the variable instead of doing this here:
publicLinkEnabled, | |
publicLinkEnabled: observeConfigBooleanValue(database, 'EnablePublicLink'), |
@@ -144,10 +144,15 @@ export default function PostInput({ | |||
onFocus(); | |||
}; | |||
|
|||
const onBlur = useCallback(() => { | |||
const onBlur = useCallback(async () => { | |||
updateDraftMessage(serverUrl, channelId, rootId, value); |
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.
Should we wait for this to be done (and make sure it didn't fail) before parsing the images?
Q.where('type', 'D'), // Channels of type 'D' | ||
Q.where('type', 'G'), // Channels of type 'D' |
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.
I feel the comments don't add much here. Would make more sense if we say something like Direct Messages
instead of Channels of type 'D'
. Nevertheless, if you want to keep it like this, on line 40 it should say Channels of type 'G'
.
@@ -27,7 +27,7 @@ type Props = { | |||
globalThreadsTab: GlobalThreadsTab; | |||
}; | |||
|
|||
const edges: Edge[] = ['left', 'right']; | |||
export const edges: Edge[] = ['left', 'right']; |
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.
Why this export is needed?
@@ -173,6 +173,7 @@ | |||
"channel_info.favorited": "Favorited", | |||
"channel_info.header": "Header:", | |||
"channel_info.ignore_mentions": "Ignore @channel, @here, @all", | |||
"channel_info.in": "In:", |
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.
Specially To
and In
are too out of context for translators. Can you make the id a bit more meaningful? Something like... channel_info.drafts.draft_in_channel
and channel_info.drafts.draft_to_user
.
"drafts": "Drafts", | ||
"Drafts": "Drafts", |
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.
These two ids seem off. Can you verify if it is intended?
Summary
Separate tab for Drafts in mobile.
Ticket Link
https://mattermost.atlassian.net/browse/MM-39356
Checklist
E2E iOS tests for PR
.Device Information
This PR was tested on: iOS version 17.5 (Both on iPhone and ipad)
Screenshots
Release Note
Note:
Will cover all the test case for this PR in separate PR.