diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -100,8 +100,6 @@ LegacyThinRawThreadInfo, ThreadTimestamps, } from '../types/thread-types.js'; -import { updateTypes } from '../types/update-types-enum.js'; -import { type ClientUpdateInfo } from '../types/update-types.js'; import type { UserInfos, AccountUserInfo, @@ -1182,18 +1180,6 @@ return !!_find({ name: 'Admins' })(threadInfo.roles); } -function identifyInvalidatedThreads( - updateInfos: $ReadOnlyArray, -): Set { - const invalidated = new Set(); - for (const updateInfo of updateInfos) { - if (updateInfo.type === updateTypes.DELETE_THREAD) { - invalidated.add(updateInfo.threadID); - } - } - return invalidated; -} - const permissionsDisabledByBlockArray = values( threadPermissionsDisabledByBlock, ); @@ -1919,7 +1905,6 @@ roleIsDefaultRole, roleIsAdminRole, threadHasAdminRole, - identifyInvalidatedThreads, permissionsDisabledByBlock, emptyItemText, threadNoun, diff --git a/lib/shared/updates/utils.js b/lib/shared/updates/utils.js new file mode 100644 --- /dev/null +++ b/lib/shared/updates/utils.js @@ -0,0 +1,18 @@ +// @flow + +import { updateTypes } from '../../types/update-types-enum.js'; +import type { ClientUpdateInfo } from '../../types/update-types.js'; + +function identifyInvalidatedThreads( + updateInfos: $ReadOnlyArray, +): Set { + const invalidated = new Set(); + for (const updateInfo of updateInfos) { + if (updateInfo.type === updateTypes.DELETE_THREAD) { + invalidated.add(updateInfo.threadID); + } + } + return invalidated; +} + +export { identifyInvalidatedThreads }; diff --git a/native/chat/settings/delete-thread.react.js b/native/chat/settings/delete-thread.react.js --- a/native/chat/settings/delete-thread.react.js +++ b/native/chat/settings/delete-thread.react.js @@ -18,10 +18,8 @@ containedThreadInfos, threadInfoSelector, } from 'lib/selectors/thread-selectors.js'; -import { - getThreadsToDeleteText, - identifyInvalidatedThreads, -} from 'lib/shared/thread-utils.js'; +import { getThreadsToDeleteText } from 'lib/shared/thread-utils.js'; +import { identifyInvalidatedThreads } from 'lib/shared/updates/utils.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; import type { ResolvedThreadInfo, diff --git a/native/chat/settings/thread-settings-leave-thread.react.js b/native/chat/settings/thread-settings-leave-thread.react.js --- a/native/chat/settings/thread-settings-leave-thread.react.js +++ b/native/chat/settings/thread-settings-leave-thread.react.js @@ -15,7 +15,7 @@ dmOperationSpecificationTypes, } from 'lib/shared/dm-ops/dm-op-types.js'; import { useProcessAndSendDMOperation } from 'lib/shared/dm-ops/process-dm-ops.js'; -import { identifyInvalidatedThreads } from 'lib/shared/thread-utils.js'; +import { identifyInvalidatedThreads } from 'lib/shared/updates/utils.js'; import type { DMLeaveThreadOperation } from 'lib/types/dm-ops'; import type { LoadingStatus } from 'lib/types/loading-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';