From 50e4497c1df5dc35bc03b2dda9537412dbdef4ac Mon Sep 17 00:00:00 2001 From: Patryk Klatka Date: Fri, 7 Jul 2023 13:21:27 +0200 Subject: [PATCH] [keyserver] Mark recalculateAllThreadPermissions as deprecated Summary: https://linear.app/comm/issue/ENG-4318/mark-recalculateallthreadpermissions-as-deprecated. Test Plan: Check if function `DEPRECATED_recalculateAllThreadPermissions` exists in `keyserver/src/updaters/thread-permission-updaters.js` Reviewers: bartek, tomek, ashoat Reviewed By: ashoat Subscribers: ashoat, tomek Differential Revision: https://phab.comm.dev/D8437 --- keyserver/src/scripts/add-leave-thread-permissions.js | 4 ++-- keyserver/src/scripts/create-sidebar-permissions.js | 4 ++-- keyserver/src/updaters/thread-permission-updaters.js | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/keyserver/src/scripts/add-leave-thread-permissions.js b/keyserver/src/scripts/add-leave-thread-permissions.js index 91920dab15..b35f59d4ce 100644 --- a/keyserver/src/scripts/add-leave-thread-permissions.js +++ b/keyserver/src/scripts/add-leave-thread-permissions.js @@ -5,12 +5,12 @@ import { threadTypes } from 'lib/types/thread-types-enum.js'; import { endScript } from './utils.js'; import { dbQuery, SQL } from '../database/database.js'; -import { recalculateAllThreadPermissions } from '../updaters/thread-permission-updaters.js'; +import { DEPRECATED_recalculateAllThreadPermissions } from '../updaters/thread-permission-updaters.js'; async function main() { try { await addLeaveThreadPermissions(); - await recalculateAllThreadPermissions(); + await DEPRECATED_recalculateAllThreadPermissions(); } catch (e) { console.warn(e); } finally { diff --git a/keyserver/src/scripts/create-sidebar-permissions.js b/keyserver/src/scripts/create-sidebar-permissions.js index 8cfb599711..0c842c972e 100644 --- a/keyserver/src/scripts/create-sidebar-permissions.js +++ b/keyserver/src/scripts/create-sidebar-permissions.js @@ -7,12 +7,12 @@ import { import { endScript } from './utils.js'; import { dbQuery, SQL } from '../database/database.js'; -import { recalculateAllThreadPermissions } from '../updaters/thread-permission-updaters.js'; +import { DEPRECATED_recalculateAllThreadPermissions } from '../updaters/thread-permission-updaters.js'; async function main() { try { await createSidebarPermissions(); - await recalculateAllThreadPermissions(); + await DEPRECATED_recalculateAllThreadPermissions(); } catch (e) { console.warn(e); } finally { diff --git a/keyserver/src/updaters/thread-permission-updaters.js b/keyserver/src/updaters/thread-permission-updaters.js index 3f2cc18540..fdc190132b 100644 --- a/keyserver/src/updaters/thread-permission-updaters.js +++ b/keyserver/src/updaters/thread-permission-updaters.js @@ -1216,7 +1216,8 @@ async function rescindPushNotifsForMemberDeletion( } } -async function recalculateAllThreadPermissions() { +// Deprecated - use updateRolesAndPermissionsForAllThreads instead +async function DEPRECATED_recalculateAllThreadPermissions() { const getAllThreads = SQL`SELECT id FROM threads`; const [result] = await dbQuery(getAllThreads); @@ -1286,6 +1287,6 @@ export { getChangesetCommitResultForExistingThread, saveMemberships, commitMembershipChangeset, - recalculateAllThreadPermissions, + DEPRECATED_recalculateAllThreadPermissions, updateRolesAndPermissionsForAllThreads, };