diff --git a/package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap b/package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap index c1bac1bb85..d32eade312 100644 --- a/package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +++ b/package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap @@ -58,6 +58,7 @@ exports[`Thread should match thread snapshot 1`] = ` ], "html": "

regular

", "id": "38ef6f7c-3090-5759-a37f-ab0053aadb96", + "message_text_updated_at": "2020-05-05T14:50:00.000Z", "parent_id": "b4612a73-fa2b-5787-bf71-1adc8f291a04", "pinned_at": null, "readBy": false, @@ -86,6 +87,7 @@ exports[`Thread should match thread snapshot 1`] = ` ], "html": "

regular

", "id": "516efa25-5d29-5c9a-ad2d-4cc183e785bd", + "message_text_updated_at": "2020-05-05T14:50:00.000Z", "parent_id": "b4612a73-fa2b-5787-bf71-1adc8f291a04", "pinned_at": null, "readBy": false, @@ -114,6 +116,7 @@ exports[`Thread should match thread snapshot 1`] = ` ], "html": "

regular

", "id": "82a83b16-b611-527c-b3ac-765ef6220490", + "message_text_updated_at": "2020-05-05T14:50:00.000Z", "parent_id": "b4612a73-fa2b-5787-bf71-1adc8f291a04", "pinned_at": null, "readBy": false, @@ -490,6 +493,40 @@ exports[`Thread should match thread snapshot 1`] = ` > 2:50 PM + + ⦁ + + + Edited + @@ -770,6 +807,40 @@ exports[`Thread should match thread snapshot 1`] = ` > 2:50 PM + + ⦁ + + + Edited + @@ -1050,6 +1121,40 @@ exports[`Thread should match thread snapshot 1`] = ` > 2:50 PM + + ⦁ + + + Edited + @@ -1370,6 +1475,40 @@ exports[`Thread should match thread snapshot 1`] = ` > 2:50 PM + + ⦁ + + + Edited + diff --git a/package/src/mock-builders/generator/message.js b/package/src/mock-builders/generator/message.js index 11ee850017..c0ce3cdb58 100644 --- a/package/src/mock-builders/generator/message.js +++ b/package/src/mock-builders/generator/message.js @@ -11,6 +11,7 @@ export const generateMessage = (options = {}) => { created_at: timestamp, html: '

regular

', id: uuidv4(), + message_text_updated_at: timestamp, text: uuidv4(), type: 'regular', updated_at: timestamp.toString(), @@ -24,6 +25,7 @@ export const generateStaticMessage = (seed, options, date) => generateMessage({ created_at: date || '2020-04-27T13:39:49.331742Z', id: uuidv5(seed, StreamReactNativeNamespace), + message_text_updated_at: date || '2020-04-27T13:39:49.331742Z', text: seed, updated_at: date || '2020-04-27T13:39:49.331742Z', ...options, diff --git a/package/src/store/QuickSqliteClient.ts b/package/src/store/QuickSqliteClient.ts index 440c96d647..7cfc8e708b 100644 --- a/package/src/store/QuickSqliteClient.ts +++ b/package/src/store/QuickSqliteClient.ts @@ -30,7 +30,7 @@ import type { PreparedQueries, Table } from './types'; * */ export class QuickSqliteClient { - static dbVersion = 4; + static dbVersion = 5; static dbName = DB_NAME; static dbLocation = DB_LOCATION; diff --git a/package/src/store/mappers/mapMessageToStorable.ts b/package/src/store/mappers/mapMessageToStorable.ts index b38edf0b97..9e267115fe 100644 --- a/package/src/store/mappers/mapMessageToStorable.ts +++ b/package/src/store/mappers/mapMessageToStorable.ts @@ -15,6 +15,7 @@ export const mapMessageToStorable = ( id, // eslint-disable-next-line @typescript-eslint/no-unused-vars latest_reactions, + message_text_updated_at, // eslint-disable-next-line @typescript-eslint/no-unused-vars own_reactions, reaction_groups, @@ -32,6 +33,7 @@ export const mapMessageToStorable = ( deletedAt: mapDateTimeToStorable(deleted_at), extraData: JSON.stringify(extraData), id, + messageTextUpdatedAt: mapDateTimeToStorable(message_text_updated_at), reactionGroups: JSON.stringify(reaction_groups), text, type, diff --git a/package/src/store/mappers/mapStorableToMessage.ts b/package/src/store/mappers/mapStorableToMessage.ts index a051cab001..2d58ad1f4d 100644 --- a/package/src/store/mappers/mapStorableToMessage.ts +++ b/package/src/store/mappers/mapStorableToMessage.ts @@ -19,7 +19,16 @@ export const mapStorableToMessage = < messageRow: TableRowJoinedUser<'messages'>; reactionRows: TableRowJoinedUser<'reactions'>[]; }): MessageResponse => { - const { createdAt, deletedAt, extraData, reactionGroups, updatedAt, user, ...rest } = messageRow; + const { + createdAt, + deletedAt, + extraData, + messageTextUpdatedAt, + reactionGroups, + updatedAt, + user, + ...rest + } = messageRow; const latestReactions = reactionRows?.map((reaction) => mapStorableToReaction(reaction)) || []; @@ -31,6 +40,7 @@ export const mapStorableToMessage = < created_at: createdAt, deleted_at: deletedAt, latest_reactions: latestReactions, + message_text_updated_at: messageTextUpdatedAt, own_reactions: ownReactions, reaction_groups: reactionGroups ? JSON.parse(reactionGroups) : {}, updated_at: updatedAt, diff --git a/package/src/store/schema.ts b/package/src/store/schema.ts index 4b3834d34e..1f657095f5 100644 --- a/package/src/store/schema.ts +++ b/package/src/store/schema.ts @@ -102,6 +102,7 @@ export const tables: Tables = { deletedAt: 'TEXT', extraData: 'TEXT', id: 'TEXT', + messageTextUpdatedAt: 'TEXT', reactionGroups: 'TEXT', text: "TEXT DEFAULT ''", type: 'TEXT', @@ -262,6 +263,7 @@ export type Schema = { deletedAt: string; extraData: string; id: string; + messageTextUpdatedAt: string; reactionGroups: string; type: MessageLabel; updatedAt: string; diff --git a/package/src/utils/removeReservedFields.ts b/package/src/utils/removeReservedFields.ts index 34642ebd95..1e8d580fbe 100644 --- a/package/src/utils/removeReservedFields.ts +++ b/package/src/utils/removeReservedFields.ts @@ -22,6 +22,7 @@ export const removeReservedFields = < 'reaction_groups', 'last_message_at', 'member_count', + 'message_text_updated_at', 'type', 'updated_at', 'reply_count',