From 4280d83ba8546d82b6b79f325dd0414651450424 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 26 Jun 2023 14:07:44 +0200 Subject: [PATCH] fix: bump libsession to allow createdAt to be given during migration --- package.json | 2 +- ts/node/migration/sessionMigrations.ts | 5 ++++- ts/session/utils/libsession/libsession_utils_contacts.ts | 1 + ts/types/sqlSharedTypes.ts | 3 +++ yarn.lock | 6 +++--- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 514b4e3a8..8f496c186 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "glob": "7.1.2", "image-type": "^4.1.0", "ip2country": "1.0.1", - "libsession_util_nodejs": "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.19/libsession_util_nodejs-v0.1.19.tar.gz", + "libsession_util_nodejs": "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.20/libsession_util_nodejs-v0.1.20.tar.gz", "libsodium-wrappers-sumo": "^0.7.9", "linkify-it": "3.0.2", "lodash": "^4.17.21", diff --git a/ts/node/migration/sessionMigrations.ts b/ts/node/migration/sessionMigrations.ts index 1471ad499..6f3efd3ea 100644 --- a/ts/node/migration/sessionMigrations.ts +++ b/ts/node/migration/sessionMigrations.ts @@ -1235,6 +1235,8 @@ function insertContactIntoContactWrapper( dbProfileKey: contact.profileKey || undefined, dbProfileUrl: contact.avatarPointer || undefined, priority, + dbCreatedAtSeconds: Math.floor((contact.active_at || Date.now()) / 1000), + // expirationTimerSeconds, }); @@ -1259,6 +1261,7 @@ function insertContactIntoContactWrapper( dbProfileKey: undefined, dbProfileUrl: undefined, priority: CONVERSATION_PRIORITIES.default, + dbCreatedAtSeconds: Math.floor(Date.now() / 1000), // expirationTimerSeconds: 0, }) ); @@ -1308,7 +1311,7 @@ function insertCommunityIntoWrapper( const convoId = community.id; // the id of a conversation has the prefix, the serverUrl and the roomToken already present, but not the pubkey const roomDetails = sqlNode.getV2OpenGroupRoom(convoId, db); - hasDebugEnvVariable && console.info('insertCommunityIntoWrapper: ', community); + // hasDebugEnvVariable && console.info('insertCommunityIntoWrapper: ', community); if ( !roomDetails || diff --git a/ts/session/utils/libsession/libsession_utils_contacts.ts b/ts/session/utils/libsession/libsession_utils_contacts.ts index a960352ae..a5d16d5df 100644 --- a/ts/session/utils/libsession/libsession_utils_contacts.ts +++ b/ts/session/utils/libsession/libsession_utils_contacts.ts @@ -70,6 +70,7 @@ async function insertContactFromDBIntoWrapperAndRefresh(id: string): Promise 0 // ? expirationTimerSeconds diff --git a/yarn.lock b/yarn.lock index 84fe9eff7..97425bef0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5148,9 +5148,9 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -"libsession_util_nodejs@https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.19/libsession_util_nodejs-v0.1.19.tar.gz": - version "0.1.19" - resolved "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.19/libsession_util_nodejs-v0.1.19.tar.gz#294c6e8ea6b767d375a9c0249bef98b65f3ae252" +"libsession_util_nodejs@https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.20/libsession_util_nodejs-v0.1.20.tar.gz": + version "0.1.20" + resolved "https://github.com/oxen-io/libsession-util-nodejs/releases/download/v0.1.20/libsession_util_nodejs-v0.1.20.tar.gz#4ff8331e4efb1725cf8bba0ef1af7496ebd8533d" dependencies: cmake-js "^7.2.1" node-addon-api "^6.1.0"