[MM-49540] Message Priority Phase 3 (#7142)

* Init

* i18 and types

* Acknowledge button, api

* Ack button + display ackd users

* Saves priority on draft and addresses some comments

* Addresses review comments round 2

* Moves fetching userprofiles upon opening ACKs

* Adds metadata column in drafts table

+ Addresses some more review comments.

* Small refactor according to review comments

* Addresses some review comments

* Addresses some review comments

* Uses local action when ACKing

* Fixes first time selecting priority and other

* Updates snapshots

* Fixes i18n

* Fixes ts errors

---------

Co-authored-by: Anurag Shivarathri <anurag6713@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Kyriakos Z
2023-04-27 11:22:03 +00:00
committed by GitHub
parent e6254885ee
commit ab4f65020a
54 changed files with 2029 additions and 575 deletions

View File

@@ -41,7 +41,12 @@ export const transformPostRecord = ({action, database, value}: TransformerArgs):
post.updateAt = raw.update_at;
post.isPinned = Boolean(raw.is_pinned);
post.message = raw.message;
post.metadata = raw.metadata && Object.keys(raw.metadata).length ? raw.metadata : null;
// When we extract the posts from the threads, we don't get the metadata
// So, it might not be present in the raw post, so we use the one from the record
const metadata = raw.metadata ?? post.metadata;
post.metadata = metadata && Object.keys(metadata).length ? metadata : null;
post.userId = raw.user_id;
post.originalId = raw.original_id;
post.pendingPostId = raw.pending_post_id;
@@ -132,6 +137,7 @@ export const transformFileRecord = ({action, database, value}: TransformerArgs):
*/
export const transformDraftRecord = ({action, database, value}: TransformerArgs): Promise<DraftModel> => {
const emptyFileInfo: FileInfo[] = [];
const emptyPostMetadata: PostMetadata = {};
const raw = value.raw as Draft;
// We use the raw id as Draft is client side only and we would only be creating/deleting drafts
@@ -141,6 +147,7 @@ export const transformDraftRecord = ({action, database, value}: TransformerArgs)
draft.message = raw?.message ?? '';
draft.channelId = raw?.channel_id ?? '';
draft.files = raw?.files ?? emptyFileInfo;
draft.metadata = raw?.metadata ?? emptyPostMetadata;
};
return prepareBaseRecord({