Fix message not being added to the database when it fails (#6043)

This commit is contained in:
Daniel Espino García 2022-03-12 20:41:07 +01:00 committed by GitHub
parent 2645f7e66e
commit 5a0a2c2220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,7 +53,7 @@ export const createPost = async (serverUrl: string, post: Partial<Post>, files:
return {error};
}
const currentUserId = queryCurrentUserId(operator.database);
const currentUserId = await queryCurrentUserId(operator.database);
const timestamp = Date.now();
const pendingPostId = post.pending_post_id || `${currentUserId}:${timestamp}`;
@ -68,6 +68,7 @@ export const createPost = async (serverUrl: string, post: Partial<Post>, files:
pending_post_id: pendingPostId,
create_at: timestamp,
update_at: timestamp,
delete_at: 0,
} as Post;
if (files.length) {