forked from Ivasoft/mattermost-mobile
Dismiss post options before executing action (#6227)
This commit is contained in:
@@ -13,9 +13,9 @@ type Props = {
|
||||
postMessage: string;
|
||||
}
|
||||
const CopyTextOption = ({postMessage}: Props) => {
|
||||
const handleCopyText = useCallback(() => {
|
||||
const handleCopyText = useCallback(async () => {
|
||||
await dismissBottomSheet(Screens.POST_OPTIONS);
|
||||
Clipboard.setString(postMessage);
|
||||
dismissBottomSheet(Screens.POST_OPTIONS);
|
||||
}, [postMessage]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -35,9 +35,9 @@ const DeletePostOption = ({combinedPost, post}: Props) => {
|
||||
}, {
|
||||
text: formatMessage({id: 'post_info.del', defaultMessage: 'Delete'}),
|
||||
style: 'destructive',
|
||||
onPress: () => {
|
||||
onPress: async () => {
|
||||
await dismissBottomSheet(Screens.POST_OPTIONS);
|
||||
deletePost(serverUrl, combinedPost || post);
|
||||
dismissBottomSheet(Screens.POST_OPTIONS);
|
||||
},
|
||||
}],
|
||||
);
|
||||
|
||||
@@ -17,9 +17,9 @@ type Props = {
|
||||
const MarkAsUnreadOption = ({postId}: Props) => {
|
||||
const serverUrl = useServerUrl();
|
||||
|
||||
const onPress = useCallback(() => {
|
||||
const onPress = useCallback(async () => {
|
||||
await dismissBottomSheet(Screens.POST_OPTIONS);
|
||||
markPostAsUnread(serverUrl, postId);
|
||||
dismissBottomSheet(Screens.POST_OPTIONS);
|
||||
}, [serverUrl, postId]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -18,9 +18,9 @@ type PinChannelProps = {
|
||||
const PinChannelOption = ({isPostPinned, postId}: PinChannelProps) => {
|
||||
const serverUrl = useServerUrl();
|
||||
|
||||
const onPress = useCallback(() => {
|
||||
const onPress = useCallback(async () => {
|
||||
await dismissBottomSheet(Screens.POST_OPTIONS);
|
||||
togglePinPost(serverUrl, postId);
|
||||
dismissBottomSheet(Screens.POST_OPTIONS);
|
||||
}, [postId, serverUrl]);
|
||||
|
||||
let defaultMessage;
|
||||
|
||||
@@ -22,9 +22,9 @@ const MarkAsUnreadOption = ({teamId, thread, post}: Props) => {
|
||||
const serverUrl = useServerUrl();
|
||||
|
||||
const onHandlePress = useCallback(async () => {
|
||||
await dismissBottomSheet(Screens.THREAD_OPTIONS);
|
||||
const timestamp = thread.unreadReplies ? Date.now() : post.createAt;
|
||||
updateThreadRead(serverUrl, teamId, thread.id, timestamp);
|
||||
dismissBottomSheet(Screens.THREAD_OPTIONS);
|
||||
}, [serverUrl, thread]);
|
||||
|
||||
const id = thread.unreadReplies ? t('global_threads.options.mark_as_read') : t('mobile.post_info.mark_unread');
|
||||
|
||||
Reference in New Issue
Block a user