diff --git a/native/redux/persist.js b/native/redux/persist.js index 9b20508e8..22fa245ae 100644 --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -1,1057 +1,1096 @@ // @flow import AsyncStorage from '@react-native-async-storage/async-storage'; import invariant from 'invariant'; import { Platform } from 'react-native'; import Orientation from 'react-native-orientation-locker'; import { createTransform } from 'redux-persist'; import type { Transform } from 'redux-persist/es/types.js'; import { convertEntryStoreToNewIDSchema, convertInviteLinksStoreToNewIDSchema, convertMessageStoreToNewIDSchema, convertRawMessageInfoToNewIDSchema, convertCalendarFilterToNewIDSchema, convertConnectionInfoToNewIDSchema, } from 'lib/_generated/migration-utils.js'; import { type ClientDBMessageStoreOperation, messageStoreOpsHandlers, } from 'lib/ops/message-store-ops.js'; import { type ReportStoreOperation, type ClientDBReportStoreOperation, convertReportsToReplaceReportOps, reportStoreOpsHandlers, } from 'lib/ops/report-store-ops.js'; import type { ClientDBThreadStoreOperation } from 'lib/ops/thread-store-ops.js'; import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js'; import { type ClientDBUserStoreOperation, type UserStoreOperation, convertUserInfosToReplaceUserOps, userStoreOpsHandlers, } from 'lib/ops/user-store-ops.js'; import { highestLocalIDSelector } from 'lib/selectors/local-id-selectors.js'; import { createAsyncMigrate } from 'lib/shared/create-async-migrate.js'; import { inconsistencyResponsesToReports } from 'lib/shared/report-utils.js'; import { getContainingThreadID, getCommunity, } from 'lib/shared/thread-utils.js'; import { DEPRECATED_unshimMessageStore, unshimFunc, } from 'lib/shared/unshim-utils.js'; import { defaultEnabledApps } from 'lib/types/enabled-apps.js'; import { defaultCalendarQuery } from 'lib/types/entry-types.js'; import { defaultCalendarFilters } from 'lib/types/filter-types.js'; import type { KeyserverStore, KeyserverInfo, } from 'lib/types/keyserver-types.js'; import { messageTypes } from 'lib/types/message-types-enum.js'; import { type LocalMessageInfo, type MessageStore, type MessageStoreThreads, } from 'lib/types/message-types.js'; import type { ReportStore, ClientReportCreationRequest, } from 'lib/types/report-types.js'; import { defaultConnectionInfo, type ConnectionInfo, } from 'lib/types/socket-types.js'; import { defaultGlobalThemeInfo } from 'lib/types/theme-types.js'; import type { ClientDBThreadInfo } from 'lib/types/thread-types.js'; import { translateClientDBMessageInfoToRawMessageInfo, translateRawMessageInfoToClientDBMessageInfo, } from 'lib/utils/message-ops-utils.js'; import { generateIDSchemaMigrationOpsForDrafts, convertMessageStoreThreadsToNewIDSchema, convertThreadStoreThreadInfosToNewIDSchema, } from 'lib/utils/migration-utils.js'; import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js'; import { convertClientDBThreadInfoToRawThreadInfo, convertRawThreadInfoToClientDBThreadInfo, } from 'lib/utils/thread-ops-utils.js'; import { getUUID } from 'lib/utils/uuid.js'; import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { updateClientDBThreadStoreThreadInfos, createUpdateDBOpsForThreadStoreThreadInfos, createUpdateDBOpsForMessageStoreMessages, createUpdateDBOpsForMessageStoreThreads, } from './client-db-utils.js'; import { defaultState } from './default-state.js'; import { migrateThreadStoreForEditThreadPermissions } from './edit-thread-permission-migration.js'; import { persistMigrationForManagePinsThreadPermission } from './manage-pins-permission-migration.js'; +import { persistMigrationToRemoveSelectRolePermissions } from './remove-select-role-permissions.js'; import type { AppState } from './state-types.js'; import { unshimClientDB } from './unshim-utils.js'; import { updateRolesAndPermissions } from './update-roles-and-permissions.js'; import { commCoreModule } from '../native-modules.js'; import { defaultDeviceCameraInfo } from '../types/camera.js'; import { isTaskCancelledError } from '../utils/error-handling.js'; import { defaultURLPrefix } from '../utils/url-utils.js'; const migrations = { [1]: (state: AppState) => ({ ...state, notifPermissionAlertInfo: defaultNotifPermissionAlertInfo, }), [2]: (state: AppState) => ({ ...state, messageSentFromRoute: [], }), [3]: state => ({ currentUserInfo: state.currentUserInfo, entryStore: state.entryStore, threadInfos: state.threadInfos, userInfos: state.userInfos, messageStore: { ...state.messageStore, currentAsOf: state.currentAsOf, }, updatesCurrentAsOf: state.currentAsOf, cookie: state.cookie, deviceToken: state.deviceToken, urlPrefix: state.urlPrefix, customServer: state.customServer, notifPermissionAlertInfo: state.notifPermissionAlertInfo, messageSentFromRoute: state.messageSentFromRoute, _persist: state._persist, }), [4]: (state: AppState) => ({ ...state, pingTimestamps: undefined, activeServerRequests: undefined, }), [5]: (state: AppState) => ({ ...state, calendarFilters: defaultCalendarFilters, }), [6]: state => ({ ...state, threadInfos: undefined, threadStore: { threadInfos: state.threadInfos, inconsistencyResponses: [], }, }), [7]: state => ({ ...state, lastUserInteraction: undefined, sessionID: undefined, entryStore: { ...state.entryStore, inconsistencyResponses: [], }, }), [8]: (state: AppState) => ({ ...state, pingTimestamps: undefined, activeServerRequests: undefined, connection: { ...defaultConnectionInfo, actualizedCalendarQuery: defaultCalendarQuery(Platform.OS), }, watchedThreadIDs: [], entryStore: { ...state.entryStore, actualizedCalendarQuery: undefined, }, }), [9]: state => ({ ...state, connection: { ...state.connection, lateResponses: [], }, }), [10]: state => ({ ...state, nextLocalID: highestLocalIDSelector(state) + 1, connection: { ...state.connection, showDisconnectedBar: false, }, messageStore: { ...state.messageStore, local: {}, }, }), [11]: (state: AppState) => ({ ...state, messageStore: DEPRECATED_unshimMessageStore(state.messageStore, [ messageTypes.IMAGES, ]), }), [12]: (state: AppState) => ({ ...state, globalThemeInfo: defaultGlobalThemeInfo, }), [13]: (state: AppState) => ({ ...state, deviceCameraInfo: defaultDeviceCameraInfo, deviceOrientation: Orientation.getInitialOrientation(), }), [14]: (state: AppState) => state, [15]: state => ({ ...state, threadStore: { ...state.threadStore, inconsistencyReports: inconsistencyResponsesToReports( state.threadStore.inconsistencyResponses, ), inconsistencyResponses: undefined, }, entryStore: { ...state.entryStore, inconsistencyReports: inconsistencyResponsesToReports( state.entryStore.inconsistencyResponses, ), inconsistencyResponses: undefined, }, queuedReports: [], }), [16]: state => { const result = { ...state, messageSentFromRoute: undefined, dataLoaded: !!state.currentUserInfo && !state.currentUserInfo.anonymous, }; if (state.navInfo) { result.navInfo = { ...state.navInfo, navigationState: undefined, }; } return result; }, [17]: state => ({ ...state, userInfos: undefined, userStore: { userInfos: state.userInfos, inconsistencyResponses: [], }, }), [18]: state => ({ ...state, userStore: { userInfos: state.userStore.userInfos, inconsistencyReports: [], }, }), [19]: state => { const threadInfos = {}; for (const threadID in state.threadStore.threadInfos) { const threadInfo = state.threadStore.threadInfos[threadID]; const { visibilityRules, ...rest } = threadInfo; threadInfos[threadID] = rest; } return { ...state, threadStore: { ...state.threadStore, threadInfos, }, }; }, [20]: (state: AppState) => ({ ...state, messageStore: DEPRECATED_unshimMessageStore(state.messageStore, [ messageTypes.UPDATE_RELATIONSHIP, ]), }), [21]: (state: AppState) => ({ ...state, messageStore: DEPRECATED_unshimMessageStore(state.messageStore, [ messageTypes.CREATE_SIDEBAR, messageTypes.SIDEBAR_SOURCE, ]), }), [22]: state => { for (const key in state.drafts) { const value = state.drafts[key]; try { commCoreModule.updateDraft(key, value); } catch (e) { if (!isTaskCancelledError(e)) { throw e; } } } return { ...state, drafts: undefined, }; }, [23]: state => ({ ...state, globalThemeInfo: defaultGlobalThemeInfo, }), [24]: state => ({ ...state, enabledApps: defaultEnabledApps, }), [25]: state => ({ ...state, crashReportsEnabled: __DEV__, }), [26]: state => { const { currentUserInfo } = state; if (currentUserInfo.anonymous) { return state; } return { ...state, crashReportsEnabled: undefined, currentUserInfo: { id: currentUserInfo.id, username: currentUserInfo.username, }, enabledReports: { crashReports: __DEV__, inconsistencyReports: __DEV__, mediaReports: __DEV__, }, }; }, [27]: state => ({ ...state, queuedReports: undefined, enabledReports: undefined, threadStore: { ...state.threadStore, inconsistencyReports: undefined, }, entryStore: { ...state.entryStore, inconsistencyReports: undefined, }, reportStore: { enabledReports: { crashReports: __DEV__, inconsistencyReports: __DEV__, mediaReports: __DEV__, }, queuedReports: [ ...state.entryStore.inconsistencyReports, ...state.threadStore.inconsistencyReports, ...state.queuedReports, ], }, }), [28]: state => { const threadParentToChildren = {}; for (const threadID in state.threadStore.threadInfos) { const threadInfo = state.threadStore.threadInfos[threadID]; const parentThreadInfo = threadInfo.parentThreadID ? state.threadStore.threadInfos[threadInfo.parentThreadID] : null; const parentIndex = parentThreadInfo ? parentThreadInfo.id : '-1'; if (!threadParentToChildren[parentIndex]) { threadParentToChildren[parentIndex] = []; } threadParentToChildren[parentIndex].push(threadID); } const rootIDs = threadParentToChildren['-1']; if (!rootIDs) { // This should never happen, but if it somehow does we'll let the state // check mechanism resolve it... return state; } const threadInfos = {}; const stack = [...rootIDs]; while (stack.length > 0) { const threadID = stack.shift(); const threadInfo = state.threadStore.threadInfos[threadID]; const parentThreadInfo = threadInfo.parentThreadID ? threadInfos[threadInfo.parentThreadID] : null; threadInfos[threadID] = { ...threadInfo, containingThreadID: getContainingThreadID( parentThreadInfo, threadInfo.type, ), community: getCommunity(parentThreadInfo), }; const children = threadParentToChildren[threadID]; if (children) { stack.push(...children); } } return { ...state, threadStore: { ...state.threadStore, threadInfos } }; }, [29]: (state: AppState) => { const updatedThreadInfos = migrateThreadStoreForEditThreadPermissions( state.threadStore.threadInfos, ); return { ...state, threadStore: { ...state.threadStore, threadInfos: updatedThreadInfos, }, }; }, [30]: (state: AppState) => { const threadInfos = state.threadStore.threadInfos; const operations = [ { type: 'remove_all', }, ...Object.keys(threadInfos).map((id: string) => ({ type: 'replace', payload: { id, threadInfo: threadInfos[id] }, })), ]; try { commCoreModule.processThreadStoreOperationsSync( threadStoreOpsHandlers.convertOpsToClientDBOps(operations), ); } catch (exception) { console.log(exception); if (isTaskCancelledError(exception)) { return state; } return { ...state, cookie: null }; } return state; }, [31]: (state: AppState) => { const messages = state.messageStore.messages; const operations: $ReadOnlyArray = [ { type: 'remove_all', }, ...Object.keys(messages).map((id: string) => ({ type: 'replace', payload: translateRawMessageInfoToClientDBMessageInfo(messages[id]), })), ]; try { commCoreModule.processMessageStoreOperationsSync(operations); } catch (exception) { console.log(exception); if (isTaskCancelledError(exception)) { return state; } return { ...state, cookie: null }; } return state; }, [32]: (state: AppState) => unshimClientDB(state, [messageTypes.MULTIMEDIA]), [33]: (state: AppState) => unshimClientDB(state, [messageTypes.REACTION]), [34]: state => { const { threadIDsToNotifIDs, ...stateSansThreadIDsToNotifIDs } = state; return stateSansThreadIDsToNotifIDs; }, [35]: (state: AppState) => unshimClientDB(state, [messageTypes.MULTIMEDIA]), [36]: (state: AppState) => { // 1. Get threads and messages from SQLite `threads` and `messages` tables. const clientDBThreadInfos = commCoreModule.getAllThreadsSync(); const clientDBMessageInfos = commCoreModule.getAllMessagesSync(); // 2. Translate `ClientDBThreadInfo`s to `RawThreadInfo`s and // `ClientDBMessageInfo`s to `RawMessageInfo`s. const rawThreadInfos = clientDBThreadInfos.map( convertClientDBThreadInfoToRawThreadInfo, ); const rawMessageInfos = clientDBMessageInfos.map( translateClientDBMessageInfoToRawMessageInfo, ); // 3. Unshim translated `RawMessageInfos` to get the TOGGLE_PIN messages const unshimmedRawMessageInfos = rawMessageInfos.map(messageInfo => unshimFunc(messageInfo, new Set([messageTypes.TOGGLE_PIN])), ); // 4. Filter out non-TOGGLE_PIN messages const filteredRawMessageInfos = unshimmedRawMessageInfos.filter( messageInfo => messageInfo.type === messageTypes.TOGGLE_PIN, ); // 5. We want only the last TOGGLE_PIN message for each message ID, // so 'pin', 'unpin', 'pin' don't count as 3 pins, but only 1. const lastMessageIDToRawMessageInfoMap = new Map(); for (const messageInfo of filteredRawMessageInfos) { const { targetMessageID } = messageInfo; lastMessageIDToRawMessageInfoMap.set(targetMessageID, messageInfo); } const lastMessageIDToRawMessageInfos = Array.from( lastMessageIDToRawMessageInfoMap.values(), ); // 6. Create a Map of threadIDs to pinnedCount const threadIDsToPinnedCount = new Map(); for (const messageInfo of lastMessageIDToRawMessageInfos) { const { threadID, type } = messageInfo; if (type === messageTypes.TOGGLE_PIN) { const pinnedCount = threadIDsToPinnedCount.get(threadID) || 0; threadIDsToPinnedCount.set(threadID, pinnedCount + 1); } } // 7. Include a pinnedCount for each rawThreadInfo const rawThreadInfosWithPinnedCount = rawThreadInfos.map(threadInfo => ({ ...threadInfo, pinnedCount: threadIDsToPinnedCount.get(threadInfo.id) || 0, })); // 8. Convert rawThreadInfos to a map of threadID to threadInfo const threadIDToThreadInfo = rawThreadInfosWithPinnedCount.reduce( (acc, threadInfo) => { acc[threadInfo.id] = threadInfo; return acc; }, {}, ); // 9. Add threadPermission to each threadInfo const rawThreadInfosWithThreadPermission = persistMigrationForManagePinsThreadPermission(threadIDToThreadInfo); // 10. Convert the new threadInfos back into an array const rawThreadInfosWithCountAndPermission = Object.keys( rawThreadInfosWithThreadPermission, ).map(id => rawThreadInfosWithThreadPermission[id]); // 11. Translate `RawThreadInfo`s to `ClientDBThreadInfo`s. const convertedClientDBThreadInfos = rawThreadInfosWithCountAndPermission.map( convertRawThreadInfoToClientDBThreadInfo, ); // 12. Construct `ClientDBThreadStoreOperation`s to clear SQLite `threads` // table and repopulate with `ClientDBThreadInfo`s. const operations: $ReadOnlyArray = [ { type: 'remove_all', }, ...convertedClientDBThreadInfos.map((thread: ClientDBThreadInfo) => ({ type: 'replace', payload: thread, })), ]; // 13. Try processing `ClientDBThreadStoreOperation`s and log out if // `processThreadStoreOperationsSync(...)` throws an exception. try { commCoreModule.processThreadStoreOperationsSync(operations); } catch (exception) { console.log(exception); return { ...state, cookie: null }; } return state; }, [37]: state => { const operations = messageStoreOpsHandlers.convertOpsToClientDBOps([ { type: 'remove_all_threads', }, { type: 'replace_threads', payload: { threads: state.messageStore.threads }, }, ]); try { commCoreModule.processMessageStoreOperationsSync(operations); } catch (exception) { console.error(exception); if (isTaskCancelledError(exception)) { return state; } return { ...state, cookie: null }; } return state; }, [38]: state => updateClientDBThreadStoreThreadInfos(state, updateRolesAndPermissions), [39]: (state: AppState) => unshimClientDB(state, [messageTypes.EDIT_MESSAGE]), [40]: state => updateClientDBThreadStoreThreadInfos(state, updateRolesAndPermissions), [41]: (state: AppState) => { const queuedReports = state.reportStore.queuedReports.map(report => ({ ...report, id: getUUID(), })); return { ...state, reportStore: { ...state.reportStore, queuedReports }, }; }, [42]: (state: AppState) => { const reportStoreOperations: $ReadOnlyArray = [ { type: 'remove_all_reports' }, ...convertReportsToReplaceReportOps(state.reportStore.queuedReports), ]; const dbOperations: $ReadOnlyArray = reportStoreOpsHandlers.convertOpsToClientDBOps(reportStoreOperations); try { commCoreModule.processReportStoreOperationsSync(dbOperations); } catch (exception) { if (isTaskCancelledError(exception)) { return state; } return { ...state, cookie: null }; } return state; }, [43]: async state => { const { messages, drafts, threads, messageStoreThreads } = await commCoreModule.getClientDBStore(); const messageStoreThreadsOperations = createUpdateDBOpsForMessageStoreThreads( messageStoreThreads, convertMessageStoreThreadsToNewIDSchema, ); const messageStoreMessagesOperations = createUpdateDBOpsForMessageStoreMessages(messages, messageInfos => messageInfos.map(convertRawMessageInfoToNewIDSchema), ); const threadOperations = createUpdateDBOpsForThreadStoreThreadInfos( threads, convertThreadStoreThreadInfosToNewIDSchema, ); const draftOperations = generateIDSchemaMigrationOpsForDrafts(drafts); try { await Promise.all([ commCoreModule.processMessageStoreOperations([ ...messageStoreMessagesOperations, ...messageStoreThreadsOperations, ]), commCoreModule.processThreadStoreOperations(threadOperations), commCoreModule.processDraftStoreOperations(draftOperations), ]); } catch (exception) { console.log(exception); return { ...state, cookie: null }; } const inviteLinksStore = state.inviteLinksStore ?? defaultState.inviteLinksStore; return { ...state, entryStore: convertEntryStoreToNewIDSchema(state.entryStore), messageStore: convertMessageStoreToNewIDSchema(state.messageStore), calendarFilters: state.calendarFilters.map( convertCalendarFilterToNewIDSchema, ), connection: convertConnectionInfoToNewIDSchema(state.connection), watchedThreadIDs: state.watchedThreadIDs.map( id => `${ashoatKeyserverID}|${id}`, ), inviteLinksStore: convertInviteLinksStoreToNewIDSchema(inviteLinksStore), }; }, [44]: async state => { const { cookie, ...rest } = state; return { ...rest, keyserverStore: { keyserverInfos: { [ashoatKeyserverID]: { cookie } } }, }; }, [45]: async state => { const { updatesCurrentAsOf, keyserverStore, ...rest } = state; return { ...rest, keyserverStore: { ...keyserverStore, keyserverInfos: { ...keyserverStore.keyserverInfos, [ashoatKeyserverID]: { ...keyserverStore.keyserverInfos[ashoatKeyserverID], updatesCurrentAsOf, }, }, }, }; }, [46]: async state => { const { currentAsOf } = state.messageStore; return { ...state, messageStore: { ...state.messageStore, currentAsOf: { [ashoatKeyserverID]: currentAsOf }, }, }; }, [47]: async state => { const { urlPrefix, keyserverStore, ...rest } = state; return { ...rest, keyserverStore: { ...keyserverStore, keyserverInfos: { ...keyserverStore.keyserverInfos, [ashoatKeyserverID]: { ...keyserverStore.keyserverInfos[ashoatKeyserverID], urlPrefix, }, }, }, }; }, [48]: async state => { const { connection, keyserverStore, ...rest } = state; return { ...rest, keyserverStore: { ...keyserverStore, keyserverInfos: { ...keyserverStore.keyserverInfos, [ashoatKeyserverID]: { ...keyserverStore.keyserverInfos[ashoatKeyserverID], connection, }, }, }, }; }, [49]: async state => { const { keyserverStore, ...rest } = state; const { connection, ...keyserverRest } = keyserverStore.keyserverInfos[ashoatKeyserverID]; return { ...rest, keyserverStore: { ...keyserverStore, keyserverInfos: { ...keyserverStore.keyserverInfos, [ashoatKeyserverID]: { ...keyserverRest, }, }, }, connection, }; }, [50]: async state => { const { connection, ...rest } = state; const { actualizedCalendarQuery, ...connectionRest } = connection; return { ...rest, connection: connectionRest, actualizedCalendarQuery, }; }, [51]: async state => { const { lastCommunicatedPlatformDetails, keyserverStore, ...rest } = state; return { ...rest, keyserverStore: { ...keyserverStore, keyserverInfos: { ...keyserverStore.keyserverInfos, [ashoatKeyserverID]: { ...keyserverStore.keyserverInfos[ashoatKeyserverID], lastCommunicatedPlatformDetails, }, }, }, }; }, [52]: async state => ({ ...state, integrityStore: { threadHashes: {}, threadHashingStatus: 'data_not_loaded', }, }), [53]: state => { if (!state.userStore.inconsistencyReports) { return state; } const reportStoreOperations = convertReportsToReplaceReportOps( state.userStore.inconsistencyReports, ); const dbOperations: $ReadOnlyArray = reportStoreOpsHandlers.convertOpsToClientDBOps(reportStoreOperations); try { commCoreModule.processReportStoreOperationsSync(dbOperations); } catch (exception) { if (isTaskCancelledError(exception)) { return state; } return { ...state, cookie: null }; } const { inconsistencyReports, ...newUserStore } = state.userStore; const queuedReports = reportStoreOpsHandlers.processStoreOperations( state.reportStore.queuedReports, reportStoreOperations, ); return { ...state, userStore: newUserStore, reportStore: { ...state.reportStore, queuedReports, }, }; }, [54]: state => { let updatedMessageStoreThreads: MessageStoreThreads = {}; for (const threadID: string in state.messageStore.threads) { const { lastNavigatedTo, lastPruned, ...rest } = state.messageStore.threads[threadID]; updatedMessageStoreThreads = { ...updatedMessageStoreThreads, [threadID]: rest, }; } return { ...state, messageStore: { ...state.messageStore, threads: updatedMessageStoreThreads, }, }; }, [55]: async state => __DEV__ ? { ...state, keyserverStore: { ...state.keyserverStore, keyserverInfos: { ...state.keyserverStore.keyserverInfos, [ashoatKeyserverID]: { ...state.keyserverStore.keyserverInfos[ashoatKeyserverID], urlPrefix: defaultURLPrefix, }, }, }, } : state, [56]: state => { const { deviceToken, keyserverStore, ...rest } = state; return { ...rest, keyserverStore: { ...keyserverStore, keyserverInfos: { ...keyserverStore.keyserverInfos, [ashoatKeyserverID]: { ...keyserverStore.keyserverInfos[ashoatKeyserverID], deviceToken, }, }, }, }; }, [57]: async state => { const { // eslint-disable-next-line no-unused-vars connection, keyserverStore: { keyserverInfos }, ...rest } = state; const newKeyserverInfos = {}; for (const key in keyserverInfos) { newKeyserverInfos[key] = { ...keyserverInfos[key], connection: { ...defaultConnectionInfo }, }; } return { ...rest, keyserverStore: { ...state.keyserverStore, keyserverInfos: newKeyserverInfos, }, }; }, [58]: async (state: AppState) => { const userStoreOperations: $ReadOnlyArray = [ { type: 'remove_all_users' }, ...convertUserInfosToReplaceUserOps(state.userStore.userInfos), ]; const dbOperations: $ReadOnlyArray = userStoreOpsHandlers.convertOpsToClientDBOps(userStoreOperations); try { await commCoreModule.processUserStoreOperations(dbOperations); } catch (exception) { if (isTaskCancelledError(exception)) { return state; } return { ...state, cookie: null }; } return state; }, + [59]: state => { + const clientDBThreadInfos = commCoreModule.getAllThreadsSync(); + const rawThreadInfos = clientDBThreadInfos.map( + convertClientDBThreadInfoToRawThreadInfo, + ); + const rawThreadInfosObject = rawThreadInfos.reduce((acc, threadInfo) => { + acc[threadInfo.id] = threadInfo; + return acc; + }, {}); + + const migratedRawThreadInfos = + persistMigrationToRemoveSelectRolePermissions(rawThreadInfosObject); + + const migratedThreadInfosArray = Object.keys(migratedRawThreadInfos).map( + id => migratedRawThreadInfos[id], + ); + const convertedClientDBThreadInfos = migratedThreadInfosArray.map( + convertRawThreadInfoToClientDBThreadInfo, + ); + const operations: $ReadOnlyArray = [ + { + type: 'remove_all', + }, + ...convertedClientDBThreadInfos.map((thread: ClientDBThreadInfo) => ({ + type: 'replace', + payload: thread, + })), + ]; + + try { + commCoreModule.processThreadStoreOperationsSync(operations); + } catch (exception) { + console.log(exception); + return { ...state, cookie: null }; + } + + return state; + }, }; // After migration 31, we'll no longer want to persist `messageStore.messages` // via redux-persist. However, we DO want to continue persisting everything in // `messageStore` EXCEPT for `messages`. The `blacklist` property in // `persistConfig` allows us to specify top-level keys that shouldn't be // persisted. However, we aren't able to specify nested keys in `blacklist`. // As a result, if we want to prevent nested keys from being persisted we'll // need to use `createTransform(...)` to specify an `inbound` function that // allows us to modify the `state` object before it's passed through // `JSON.stringify(...)` and written to disk. We specify the keys for which // this transformation should be executed in the `whitelist` property of the // `config` object that's passed to `createTransform(...)`. // eslint-disable-next-line no-unused-vars type PersistedMessageStore = { +local: { +[id: string]: LocalMessageInfo }, +currentAsOf: { +[keyserverID: string]: number }, }; const messageStoreMessagesBlocklistTransform: Transform = createTransform( (state: MessageStore): PersistedMessageStore => { const { messages, threads, ...messageStoreSansMessages } = state; return { ...messageStoreSansMessages }; }, (state: MessageStore): MessageStore => { // We typically expect `messageStore.messages` to be `undefined` because // messages are persisted in the SQLite `messages` table rather than via // `redux-persist`. In this case we want to set `messageStore.messages` // to {} so we don't run into issues with `messageStore.messages` being // `undefined` (https://phab.comm.dev/D5545). // // However, in the case that a user is upgrading from a client where // `persistConfig.version` < 31, we expect `messageStore.messages` to // contain messages stored via `redux-persist` that we need in order // to correctly populate the SQLite `messages` table in migration 31 // (https://phab.comm.dev/D2600). // // However, because `messageStoreMessagesBlocklistTransform` modifies // `messageStore` before migrations are run, we need to make sure we aren't // inadvertently clearing `messageStore.messages` (by setting to {}) before // messages are stored in SQLite (https://linear.app/comm/issue/ENG-2377). return { ...state, threads: state.threads ?? {}, messages: state.messages ?? {}, }; }, { whitelist: ['messageStore'] }, ); type PersistedReportStore = $Diff< ReportStore, { +queuedReports: $ReadOnlyArray }, >; const reportStoreTransform: Transform = createTransform( (state: ReportStore): PersistedReportStore => { return { enabledReports: state.enabledReports }; }, (state: PersistedReportStore): ReportStore => { return { ...state, queuedReports: [] }; }, { whitelist: ['reportStore'] }, ); type PersistedKeyserverInfo = $Diff< KeyserverInfo, { +connection: ConnectionInfo }, >; type PersistedKeyserverStore = { +keyserverInfos: { +[key: string]: PersistedKeyserverInfo }, }; const keyserverStoreTransform: Transform = createTransform( (state: KeyserverStore): PersistedKeyserverStore => { const keyserverInfos = {}; for (const key in state.keyserverInfos) { const { connection, ...rest } = state.keyserverInfos[key]; keyserverInfos[key] = rest; } return { ...state, keyserverInfos, }; }, (state: PersistedKeyserverStore): KeyserverStore => { const keyserverInfos = {}; for (const key in state.keyserverInfos) { keyserverInfos[key] = { ...state.keyserverInfos[key], connection: { ...defaultConnectionInfo }, }; } return { ...state, keyserverInfos, }; }, { whitelist: ['keyserverStore'] }, ); const persistConfig = { key: 'root', storage: AsyncStorage, blacklist: [ 'loadingStatuses', 'lifecycleState', 'dimensions', 'draftStore', 'connectivity', 'deviceOrientation', 'frozen', 'threadStore', 'storeLoaded', 'connection', ], debug: __DEV__, - version: 58, + version: 59, transforms: [ messageStoreMessagesBlocklistTransform, reportStoreTransform, keyserverStoreTransform, ], migrate: (createAsyncMigrate(migrations, { debug: __DEV__ }): any), timeout: ((__DEV__ ? 0 : undefined): number | void), }; const codeVersion: number = commCoreModule.getCodeVersion(); // This local exists to avoid a circular dependency where redux-setup needs to // import all the navigation and screen stuff, but some of those screens want to // access the persistor to purge its state. let storedPersistor = null; function setPersistor(persistor: *) { storedPersistor = persistor; } function getPersistor(): empty { invariant(storedPersistor, 'should be set'); return storedPersistor; } export { persistConfig, codeVersion, setPersistor, getPersistor }; diff --git a/native/redux/remove-select-role-permissions.js b/native/redux/remove-select-role-permissions.js new file mode 100644 index 000000000..908aa6703 --- /dev/null +++ b/native/redux/remove-select-role-permissions.js @@ -0,0 +1,45 @@ +// @flow + +import type { RawThreadInfos } from 'lib/types/thread-types.js'; +import { permissionsToRemoveInMigration } from 'lib/utils/migration-utils.js'; + +function persistMigrationToRemoveSelectRolePermissions( + rawThreadInfos: RawThreadInfos, +): RawThreadInfos { + // This is to handle the client being logged out and not having any threads + // to provide here. In this case, we want the migration to still succeed + // so we early return an empty object. + if (!rawThreadInfos) { + return {}; + } + + const updatedThreadInfos = {}; + for (const threadID in rawThreadInfos) { + const threadInfo = rawThreadInfos[threadID]; + const { roles } = threadInfo; + + const updatedRoles = {}; + for (const roleID in roles) { + const role = roles[roleID]; + const { permissions: rolePermissions } = role; + const updatedPermissions = {}; + for (const permission in rolePermissions) { + if (!permissionsToRemoveInMigration.includes(permission)) { + updatedPermissions[permission] = rolePermissions[permission]; + } + } + updatedRoles[roleID] = { ...role, permissions: updatedPermissions }; + } + + const updatedThreadInfo = { + ...threadInfo, + roles: updatedRoles, + }; + + updatedThreadInfos[threadID] = updatedThreadInfo; + } + + return updatedThreadInfos; +} + +export { persistMigrationToRemoveSelectRolePermissions }; diff --git a/native/redux/remove-select-role-permissions.test.js b/native/redux/remove-select-role-permissions.test.js new file mode 100644 index 000000000..0e45e187a --- /dev/null +++ b/native/redux/remove-select-role-permissions.test.js @@ -0,0 +1,78 @@ +// @flow + +import type { RawThreadInfos } from 'lib/types/thread-types.js'; +import { deepDiff } from 'lib/utils/objects.js'; + +import { persistMigrationToRemoveSelectRolePermissions } from './remove-select-role-permissions.js'; +import { threadStoreThreadsWithIncorrectPermissions } from './update-roles-and-permissions-test-data.js'; + +describe('persistMigrationToRemoveDescendantOpenVoiced', () => { + it("should correctly remove 'descendant_open_voiced' from permissions", () => { + const migratedRawThreadInfos: RawThreadInfos = + persistMigrationToRemoveSelectRolePermissions( + threadStoreThreadsWithIncorrectPermissions, + ); + + const threadDiff = deepDiff( + threadStoreThreadsWithIncorrectPermissions, + migratedRawThreadInfos, + ); + + expect(threadDiff).toStrictEqual({ + '256|84852': { + roles: { + '256|84853': { + permissions: { + descendant_add_members: true, + descendant_edit_message: true, + descendant_react_to_message: true, + join_thread: true, + }, + }, + '256|84854': { + permissions: { + descendant_add_members: true, + descendant_change_role: true, + descendant_edit_entries: true, + descendant_edit_permissions: true, + descendant_edit_thread: true, + descendant_edit_thread_avatar: true, + descendant_edit_thread_color: true, + descendant_edit_thread_description: true, + descendant_manage_pins: true, + descendant_remove_members: true, + descendant_toplevel_create_sidebars: true, + descendant_toplevel_create_subthreads: true, + }, + }, + }, + }, + '256|85022': { + roles: { + '256|85024': { + permissions: { + descendant_add_members: true, + descendant_change_role: true, + descendant_edit_entries: true, + descendant_edit_permissions: true, + descendant_edit_thread: true, + descendant_edit_thread_avatar: true, + descendant_edit_thread_color: true, + descendant_edit_thread_description: true, + descendant_manage_pins: true, + descendant_remove_members: true, + descendant_toplevel_create_sidebars: true, + descendant_toplevel_create_subthreads: true, + }, + }, + '256|85027': { + permissions: { + descendant_open_voiced: true, + join_thread: true, + }, + }, + }, + }, + }); + }); +}); diff --git a/native/redux/update-roles-and-permissions-test-data.js b/native/redux/update-roles-and-permissions-test-data.js index c63ffb8f8..e60a6e354 100644 --- a/native/redux/update-roles-and-permissions-test-data.js +++ b/native/redux/update-roles-and-permissions-test-data.js @@ -1,8601 +1,10031 @@ // @flow import type { ThreadStoreThreadInfos } from 'lib/types/thread-types.js'; const threadStoreThreads: ThreadStoreThreadInfos = { '1': { color: 'b8753d', community: null, containingThreadID: null, creationTime: 1679537878106, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '1', value: true, }, voiced: { source: null, value: false, }, }, role: '83795', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: 'This is the first community on Comm. In the future it will be possible to create chats outside of a community, but for now all of these chats get set with GENESIS as their parent. GENESIS is hosted on Ashoat’s keyserver.', id: '1', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: '1', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: '1', value: true, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: '83796', }, { id: '84589', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '1', value: true, }, voiced: { source: null, value: false, }, }, role: '83795', }, ], name: 'GENESIS', parentThreadID: null, pinnedCount: 0, repliesCount: 0, roles: { '83795': { id: '83795', isDefault: true, name: 'Members', permissions: { descendant_open_know_of: true, descendant_open_visible: true, descendant_opentoplevel_join_thread: true, know_of: true, visible: true, }, }, '83796': { id: '83796', isDefault: false, name: 'Admins', permissions: { add_members: true, change_role: true, child_join_thread: true, create_sidebars: true, create_subthreads: true, delete_thread: true, descendant_add_members: true, descendant_change_role: true, descendant_delete_thread: true, descendant_edit_entries: true, descendant_edit_permissions: true, descendant_edit_thread: true, descendant_edit_thread_avatar: true, descendant_edit_thread_color: true, descendant_edit_thread_description: true, descendant_know_of: true, descendant_manage_pins: true, descendant_remove_members: true, descendant_toplevel_create_sidebars: true, descendant_toplevel_create_subthreads: true, descendant_toplevel_join_thread: true, descendant_visible: true, descendant_voiced: true, edit_entries: true, edit_message: true, edit_thread: true, edit_thread_avatar: true, edit_thread_color: true, edit_thread_description: true, know_of: true, manage_pins: true, react_to_message: true, remove_members: true, visible: true, voiced: true, }, }, }, type: 12, }, '84596': { color: '575757', community: '1', containingThreadID: '1', creationTime: 1680734420100, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84596', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84596', value: true, }, edit_message: { source: '84596', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84596', value: true, }, edit_thread_description: { source: '84596', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84596', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84596', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84596', value: true, }, voiced: { source: '84596', value: true, }, }, role: '84597', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: 'This is your private chat, where you can set reminders and jot notes in private!', id: '84596', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '84589', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84596', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84596', value: true, }, edit_message: { source: '84596', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84596', value: true, }, edit_thread_description: { source: '84596', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84596', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84596', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84596', value: true, }, voiced: { source: '84596', value: true, }, }, role: '84597', }, ], name: 'hillary', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84597': { id: '84597', isDefault: true, name: 'Members', permissions: { child_open_join_thread: true, create_sidebars: true, descendant_open_know_of: true, descendant_open_visible: true, edit_entries: true, edit_message: true, edit_thread_color: true, edit_thread_description: true, know_of: true, react_to_message: true, visible: true, voiced: true, }, }, }, type: 7, }, '84598': { color: '5c9f5f', community: '1', containingThreadID: '1', creationTime: 1680734420159, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84598', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84598', value: true, }, edit_message: { source: '84598', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84598', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84598', value: true, }, edit_thread_description: { source: '84598', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84598', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84598', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84598', value: true, }, voiced: { source: '84598', value: true, }, }, role: '84599', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84598', members: [ { id: '256', isSender: true, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '84598', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '84598', value: true, }, edit_message: { source: '84598', value: true, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '84598', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '84598', value: true, }, edit_thread_description: { source: '84598', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '84598', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: '84598', value: true, }, remove_members: { source: '1', value: true, }, visible: { source: '84598', value: true, }, voiced: { source: '84598', value: true, }, }, role: '84599', }, { id: '84589', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84598', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84598', value: true, }, edit_message: { source: '84598', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84598', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84598', value: true, }, edit_thread_description: { source: '84598', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84598', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84598', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84598', value: true, }, voiced: { source: '84598', value: true, }, }, role: '84599', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84599': { id: '84599', isDefault: true, name: 'Members', permissions: { child_open_join_thread: true, create_sidebars: true, descendant_open_know_of: true, descendant_open_visible: true, edit_entries: true, edit_message: true, edit_thread: true, edit_thread_color: true, edit_thread_description: true, know_of: true, react_to_message: true, visible: true, voiced: true, }, }, }, type: 6, }, '84627': { color: 'aa4b4b', community: '1', containingThreadID: '1', creationTime: 1680734427175, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84627', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84627', value: true, }, edit_message: { source: '84627', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84627', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84627', value: true, }, edit_thread_description: { source: '84627', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84627', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84627', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84627', value: true, }, voiced: { source: '84627', value: true, }, }, role: '84628', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84627', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '83969', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84627', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84627', value: true, }, edit_message: { source: '84627', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84627', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84627', value: true, }, edit_thread_description: { source: '84627', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84627', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84627', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84627', value: true, }, voiced: { source: '84627', value: true, }, }, role: '84628', }, { id: '84589', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84627', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84627', value: true, }, edit_message: { source: '84627', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84627', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84627', value: true, }, edit_thread_description: { source: '84627', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84627', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84627', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84627', value: true, }, voiced: { source: '84627', value: true, }, }, role: '84628', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84628': { id: '84628', isDefault: true, name: 'Members', permissions: { child_open_join_thread: true, create_sidebars: true, descendant_open_know_of: true, descendant_open_visible: true, edit_entries: true, edit_message: true, edit_thread: true, edit_thread_color: true, edit_thread_description: true, know_of: true, react_to_message: true, visible: true, voiced: true, }, }, }, type: 6, }, '84656': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1680734490721, currentUser: { permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84656', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '83809', isSender: true, permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', }, { id: '83969', isSender: true, permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', }, { id: '84589', isSender: false, permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', }, ], name: 'group', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84657': { id: '84657', isDefault: true, name: 'Members', permissions: { add_members: true, child_open_join_thread: true, create_sidebars: true, create_subthreads: true, descendant_open_know_of: true, descendant_open_visible: true, descendant_opentoplevel_join_thread: true, edit_entries: true, edit_message: true, edit_permissions: true, edit_thread: true, edit_thread_avatar: true, edit_thread_color: true, edit_thread_description: true, know_of: true, leave_thread: true, react_to_message: true, remove_members: true, visible: true, voiced: true, }, }, }, type: 4, }, '86071': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1681160151827, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '86071', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '86071', value: true, }, edit_message: { source: '86071', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '86071', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '86071', value: true, }, edit_thread_description: { source: '86071', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '86071', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '86071', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '86071', value: true, }, voiced: { source: '86071', value: true, }, }, role: '86072', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '86071', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '84589', isSender: true, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '86071', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '86071', value: true, }, edit_message: { source: '86071', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '86071', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '86071', value: true, }, edit_thread_description: { source: '86071', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '86071', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '86071', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '86071', value: true, }, voiced: { source: '86071', value: true, }, }, role: '86072', }, { id: '85999', isSender: true, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '86071', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '86071', value: true, }, edit_message: { source: '86071', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '86071', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '86071', value: true, }, edit_thread_description: { source: '86071', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '86071', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '86071', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '86071', value: true, }, voiced: { source: '86071', value: true, }, }, role: '86072', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '86072': { id: '86072', isDefault: true, name: 'Members', permissions: { child_open_join_thread: true, create_sidebars: true, descendant_open_know_of: true, descendant_open_visible: true, edit_entries: true, edit_message: true, edit_thread: true, edit_thread_color: true, edit_thread_description: true, know_of: true, react_to_message: true, visible: true, voiced: true, }, }, }, type: 6, }, '87789': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1682367957349, currentUser: { permissions: { add_members: { source: '87789', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87789', value: true, }, create_subthreads: { source: '87789', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87789', value: true, }, edit_message: { source: '87789', value: true, }, edit_permissions: { source: '87789', value: true, }, edit_thread: { source: '87789', value: true, }, edit_thread_avatar: { source: '87789', value: true, }, edit_thread_color: { source: '87789', value: true, }, edit_thread_description: { source: '87789', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87789', value: true, }, leave_thread: { source: '87789', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87789', value: true, }, remove_members: { source: '87789', value: true, }, visible: { source: '87789', value: true, }, voiced: { source: '87789', value: true, }, }, role: '87790', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87789', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '83809', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: '84656', value: true, }, know_of: { source: '84656', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '84656', value: true, }, voiced: { source: null, value: false, }, }, role: null, }, { id: '83969', isSender: false, permissions: { add_members: { source: '87789', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87789', value: true, }, create_subthreads: { source: '87789', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87789', value: true, }, edit_message: { source: '87789', value: true, }, edit_permissions: { source: '87789', value: true, }, edit_thread: { source: '87789', value: true, }, edit_thread_avatar: { source: '87789', value: true, }, edit_thread_color: { source: '87789', value: true, }, edit_thread_description: { source: '87789', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87789', value: true, }, leave_thread: { source: '87789', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87789', value: true, }, remove_members: { source: '87789', value: true, }, visible: { source: '87789', value: true, }, voiced: { source: '87789', value: true, }, }, role: '87790', }, { id: '84589', isSender: false, permissions: { add_members: { source: '87789', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87789', value: true, }, create_subthreads: { source: '87789', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87789', value: true, }, edit_message: { source: '87789', value: true, }, edit_permissions: { source: '87789', value: true, }, edit_thread: { source: '87789', value: true, }, edit_thread_avatar: { source: '87789', value: true, }, edit_thread_color: { source: '87789', value: true, }, edit_thread_description: { source: '87789', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87789', value: true, }, leave_thread: { source: '87789', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87789', value: true, }, remove_members: { source: '87789', value: true, }, visible: { source: '87789', value: true, }, voiced: { source: '87789', value: true, }, }, role: '87790', }, ], name: 'Subthread', parentThreadID: '84656', pinnedCount: 0, repliesCount: 0, roles: { '87790': { id: '87790', isDefault: true, name: 'Members', permissions: { add_members: true, child_open_join_thread: true, create_sidebars: true, create_subthreads: true, descendant_open_know_of: true, descendant_open_visible: true, descendant_opentoplevel_join_thread: true, edit_entries: true, edit_message: true, edit_permissions: true, edit_thread: true, edit_thread_avatar: true, edit_thread_color: true, edit_thread_description: true, know_of: true, leave_thread: true, react_to_message: true, remove_members: true, visible: true, voiced: true, }, }, }, type: 3, }, '87817': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1682368005862, currentUser: { permissions: { add_members: { source: '87817', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87817', value: true, }, create_subthreads: { source: '87817', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87817', value: true, }, edit_message: { source: '87817', value: true, }, edit_permissions: { source: '87817', value: true, }, edit_thread: { source: '87817', value: true, }, edit_thread_avatar: { source: '87817', value: true, }, edit_thread_color: { source: '87817', value: true, }, edit_thread_description: { source: '87817', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87817', value: true, }, leave_thread: { source: '87817', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87817', value: true, }, remove_members: { source: '87817', value: true, }, visible: { source: '87817', value: true, }, voiced: { source: '87817', value: true, }, }, role: '87818', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87817', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '83809', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: '84656', value: true, }, know_of: { source: '84656', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '84656', value: true, }, voiced: { source: null, value: false, }, }, role: null, }, { id: '83969', isSender: false, permissions: { add_members: { source: '87817', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87817', value: true, }, create_subthreads: { source: '87817', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87817', value: true, }, edit_message: { source: '87817', value: true, }, edit_permissions: { source: '87817', value: true, }, edit_thread: { source: '87817', value: true, }, edit_thread_avatar: { source: '87817', value: true, }, edit_thread_color: { source: '87817', value: true, }, edit_thread_description: { source: '87817', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87817', value: true, }, leave_thread: { source: '87817', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87817', value: true, }, remove_members: { source: '87817', value: true, }, visible: { source: '87817', value: true, }, voiced: { source: '87817', value: true, }, }, role: '87818', }, { id: '84589', isSender: true, permissions: { add_members: { source: '87817', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87817', value: true, }, create_subthreads: { source: '87817', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87817', value: true, }, edit_message: { source: '87817', value: true, }, edit_permissions: { source: '87817', value: true, }, edit_thread: { source: '87817', value: true, }, edit_thread_avatar: { source: '87817', value: true, }, edit_thread_color: { source: '87817', value: true, }, edit_thread_description: { source: '87817', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87817', value: true, }, leave_thread: { source: '87817', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87817', value: true, }, remove_members: { source: '87817', value: true, }, visible: { source: '87817', value: true, }, voiced: { source: '87817', value: true, }, }, role: '87818', }, ], name: '', parentThreadID: '84656', pinnedCount: 0, repliesCount: 0, roles: { '87818': { id: '87818', isDefault: true, name: 'Members', permissions: { add_members: true, child_open_join_thread: true, create_sidebars: true, create_subthreads: true, descendant_open_know_of: true, descendant_open_visible: true, descendant_opentoplevel_join_thread: true, edit_entries: true, edit_message: true, edit_permissions: true, edit_thread: true, edit_thread_avatar: true, edit_thread_color: true, edit_thread_description: true, know_of: true, leave_thread: true, react_to_message: true, remove_members: true, visible: true, voiced: true, }, }, }, type: 3, }, '87837': { color: '6d49ab', community: '1', containingThreadID: '86071', creationTime: 1682368041060, currentUser: { permissions: { add_members: { source: '87837', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: '87837', value: true, }, edit_permissions: { source: '87837', value: true, }, edit_thread: { source: '87837', value: true, }, edit_thread_avatar: { source: '87837', value: true, }, edit_thread_color: { source: '87837', value: true, }, edit_thread_description: { source: '87837', value: true, }, join_thread: { source: '86071', value: true, }, know_of: { source: '86071', value: true, }, leave_thread: { source: '87837', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87837', value: true, }, remove_members: { source: '87837', value: true, }, visible: { source: '86071', value: true, }, voiced: { source: '87837', value: true, }, }, role: '87838', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87837', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '84589', isSender: true, permissions: { add_members: { source: '87837', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: '87837', value: true, }, edit_permissions: { source: '87837', value: true, }, edit_thread: { source: '87837', value: true, }, edit_thread_avatar: { source: '87837', value: true, }, edit_thread_color: { source: '87837', value: true, }, edit_thread_description: { source: '87837', value: true, }, join_thread: { source: '86071', value: true, }, know_of: { source: '86071', value: true, }, leave_thread: { source: '87837', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87837', value: true, }, remove_members: { source: '87837', value: true, }, visible: { source: '86071', value: true, }, voiced: { source: '87837', value: true, }, }, role: '87838', }, { id: '85999', isSender: false, permissions: { add_members: { source: '87837', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: '87837', value: true, }, edit_permissions: { source: '87837', value: true, }, edit_thread: { source: '87837', value: true, }, edit_thread_avatar: { source: '87837', value: true, }, edit_thread_color: { source: '87837', value: true, }, edit_thread_description: { source: '87837', value: true, }, join_thread: { source: '86071', value: true, }, know_of: { source: '86071', value: true, }, leave_thread: { source: '87837', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87837', value: true, }, remove_members: { source: '87837', value: true, }, visible: { source: '86071', value: true, }, voiced: { source: '87837', value: true, }, }, role: '87838', }, ], name: 'Hello', parentThreadID: '86071', pinnedCount: 0, repliesCount: 1, roles: { '87838': { id: '87838', isDefault: true, name: 'Members', permissions: { add_members: true, edit_message: true, edit_permissions: true, edit_thread: true, edit_thread_avatar: true, edit_thread_color: true, edit_thread_description: true, leave_thread: true, react_to_message: true, remove_members: true, voiced: true, }, }, }, sourceMessageID: '86339', type: 5, }, }; // Clear out contents of role permissions to ensure `updateRolesAndPermissions` // constructs them properly without depending on anything from existing store. const threadStoreThreadsWithEmptyRolePermissions: ThreadStoreThreadInfos = { '1': { color: 'b8753d', community: null, containingThreadID: null, creationTime: 1679537878106, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '1', value: true, }, voiced: { source: null, value: false, }, }, role: '83795', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: 'This is the first community on Comm. In the future it will be possible to create chats outside of a community, but for now all of these chats get set with GENESIS as their parent. GENESIS is hosted on Ashoat’s keyserver.', id: '1', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: '1', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: '1', value: true, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: '83796', }, { id: '84589', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '1', value: true, }, voiced: { source: null, value: false, }, }, role: '83795', }, ], name: 'GENESIS', parentThreadID: null, pinnedCount: 0, repliesCount: 0, roles: { '83795': { id: '83795', isDefault: true, name: 'Members', permissions: {}, }, '83796': { id: '83796', isDefault: false, name: 'Admins', permissions: {}, }, }, type: 12, }, '84596': { color: '575757', community: '1', containingThreadID: '1', creationTime: 1680734420100, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84596', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84596', value: true, }, edit_message: { source: '84596', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84596', value: true, }, edit_thread_description: { source: '84596', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84596', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84596', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84596', value: true, }, voiced: { source: '84596', value: true, }, }, role: '84597', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: 'This is your private chat, where you can set reminders and jot notes in private!', id: '84596', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '84589', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84596', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84596', value: true, }, edit_message: { source: '84596', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84596', value: true, }, edit_thread_description: { source: '84596', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84596', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84596', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84596', value: true, }, voiced: { source: '84596', value: true, }, }, role: '84597', }, ], name: 'hillary', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84597': { id: '84597', isDefault: true, name: 'Members', permissions: {}, }, }, type: 7, }, '84598': { color: '5c9f5f', community: '1', containingThreadID: '1', creationTime: 1680734420159, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84598', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84598', value: true, }, edit_message: { source: '84598', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84598', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84598', value: true, }, edit_thread_description: { source: '84598', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84598', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84598', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84598', value: true, }, voiced: { source: '84598', value: true, }, }, role: '84599', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84598', members: [ { id: '256', isSender: true, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '84598', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '84598', value: true, }, edit_message: { source: '84598', value: true, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '84598', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '84598', value: true, }, edit_thread_description: { source: '84598', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '84598', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: '84598', value: true, }, remove_members: { source: '1', value: true, }, visible: { source: '84598', value: true, }, voiced: { source: '84598', value: true, }, }, role: '84599', }, { id: '84589', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84598', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84598', value: true, }, edit_message: { source: '84598', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84598', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84598', value: true, }, edit_thread_description: { source: '84598', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84598', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84598', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84598', value: true, }, voiced: { source: '84598', value: true, }, }, role: '84599', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84599': { id: '84599', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '84627': { color: 'aa4b4b', community: '1', containingThreadID: '1', creationTime: 1680734427175, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84627', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84627', value: true, }, edit_message: { source: '84627', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84627', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84627', value: true, }, edit_thread_description: { source: '84627', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84627', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84627', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84627', value: true, }, voiced: { source: '84627', value: true, }, }, role: '84628', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84627', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '83969', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84627', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84627', value: true, }, edit_message: { source: '84627', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84627', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84627', value: true, }, edit_thread_description: { source: '84627', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84627', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84627', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84627', value: true, }, voiced: { source: '84627', value: true, }, }, role: '84628', }, { id: '84589', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84627', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84627', value: true, }, edit_message: { source: '84627', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84627', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84627', value: true, }, edit_thread_description: { source: '84627', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84627', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84627', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84627', value: true, }, voiced: { source: '84627', value: true, }, }, role: '84628', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84628': { id: '84628', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '84656': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1680734490721, currentUser: { permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84656', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '83809', isSender: true, permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', }, { id: '83969', isSender: true, permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', }, { id: '84589', isSender: false, permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', }, ], name: 'group', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84657': { id: '84657', isDefault: true, name: 'Members', permissions: {}, }, }, type: 4, }, '86071': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1681160151827, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '86071', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '86071', value: true, }, edit_message: { source: '86071', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '86071', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '86071', value: true, }, edit_thread_description: { source: '86071', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '86071', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '86071', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '86071', value: true, }, voiced: { source: '86071', value: true, }, }, role: '86072', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '86071', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '84589', isSender: true, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '86071', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '86071', value: true, }, edit_message: { source: '86071', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '86071', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '86071', value: true, }, edit_thread_description: { source: '86071', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '86071', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '86071', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '86071', value: true, }, voiced: { source: '86071', value: true, }, }, role: '86072', }, { id: '85999', isSender: true, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '86071', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '86071', value: true, }, edit_message: { source: '86071', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '86071', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '86071', value: true, }, edit_thread_description: { source: '86071', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '86071', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '86071', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '86071', value: true, }, voiced: { source: '86071', value: true, }, }, role: '86072', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '86072': { id: '86072', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '87789': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1682367957349, currentUser: { permissions: { add_members: { source: '87789', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87789', value: true, }, create_subthreads: { source: '87789', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87789', value: true, }, edit_message: { source: '87789', value: true, }, edit_permissions: { source: '87789', value: true, }, edit_thread: { source: '87789', value: true, }, edit_thread_avatar: { source: '87789', value: true, }, edit_thread_color: { source: '87789', value: true, }, edit_thread_description: { source: '87789', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87789', value: true, }, leave_thread: { source: '87789', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87789', value: true, }, remove_members: { source: '87789', value: true, }, visible: { source: '87789', value: true, }, voiced: { source: '87789', value: true, }, }, role: '87790', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87789', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '83809', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: '84656', value: true, }, know_of: { source: '84656', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '84656', value: true, }, voiced: { source: null, value: false, }, }, role: null, }, { id: '83969', isSender: false, permissions: { add_members: { source: '87789', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87789', value: true, }, create_subthreads: { source: '87789', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87789', value: true, }, edit_message: { source: '87789', value: true, }, edit_permissions: { source: '87789', value: true, }, edit_thread: { source: '87789', value: true, }, edit_thread_avatar: { source: '87789', value: true, }, edit_thread_color: { source: '87789', value: true, }, edit_thread_description: { source: '87789', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87789', value: true, }, leave_thread: { source: '87789', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87789', value: true, }, remove_members: { source: '87789', value: true, }, visible: { source: '87789', value: true, }, voiced: { source: '87789', value: true, }, }, role: '87790', }, { id: '84589', isSender: false, permissions: { add_members: { source: '87789', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87789', value: true, }, create_subthreads: { source: '87789', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87789', value: true, }, edit_message: { source: '87789', value: true, }, edit_permissions: { source: '87789', value: true, }, edit_thread: { source: '87789', value: true, }, edit_thread_avatar: { source: '87789', value: true, }, edit_thread_color: { source: '87789', value: true, }, edit_thread_description: { source: '87789', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87789', value: true, }, leave_thread: { source: '87789', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87789', value: true, }, remove_members: { source: '87789', value: true, }, visible: { source: '87789', value: true, }, voiced: { source: '87789', value: true, }, }, role: '87790', }, ], name: 'Subthread', parentThreadID: '84656', pinnedCount: 0, repliesCount: 0, roles: { '87790': { id: '87790', isDefault: true, name: 'Members', permissions: {}, }, }, type: 3, }, '87817': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1682368005862, currentUser: { permissions: { add_members: { source: '87817', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87817', value: true, }, create_subthreads: { source: '87817', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87817', value: true, }, edit_message: { source: '87817', value: true, }, edit_permissions: { source: '87817', value: true, }, edit_thread: { source: '87817', value: true, }, edit_thread_avatar: { source: '87817', value: true, }, edit_thread_color: { source: '87817', value: true, }, edit_thread_description: { source: '87817', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87817', value: true, }, leave_thread: { source: '87817', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87817', value: true, }, remove_members: { source: '87817', value: true, }, visible: { source: '87817', value: true, }, voiced: { source: '87817', value: true, }, }, role: '87818', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87817', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: '1', value: true, }, create_subthreads: { source: '1', value: true, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: '1', value: true, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '83809', isSender: false, permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: '84656', value: true, }, know_of: { source: '84656', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '84656', value: true, }, voiced: { source: null, value: false, }, }, role: null, }, { id: '83969', isSender: false, permissions: { add_members: { source: '87817', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87817', value: true, }, create_subthreads: { source: '87817', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87817', value: true, }, edit_message: { source: '87817', value: true, }, edit_permissions: { source: '87817', value: true, }, edit_thread: { source: '87817', value: true, }, edit_thread_avatar: { source: '87817', value: true, }, edit_thread_color: { source: '87817', value: true, }, edit_thread_description: { source: '87817', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87817', value: true, }, leave_thread: { source: '87817', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87817', value: true, }, remove_members: { source: '87817', value: true, }, visible: { source: '87817', value: true, }, voiced: { source: '87817', value: true, }, }, role: '87818', }, { id: '84589', isSender: true, permissions: { add_members: { source: '87817', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87817', value: true, }, create_subthreads: { source: '87817', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87817', value: true, }, edit_message: { source: '87817', value: true, }, edit_permissions: { source: '87817', value: true, }, edit_thread: { source: '87817', value: true, }, edit_thread_avatar: { source: '87817', value: true, }, edit_thread_color: { source: '87817', value: true, }, edit_thread_description: { source: '87817', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87817', value: true, }, leave_thread: { source: '87817', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87817', value: true, }, remove_members: { source: '87817', value: true, }, visible: { source: '87817', value: true, }, voiced: { source: '87817', value: true, }, }, role: '87818', }, ], name: '', parentThreadID: '84656', pinnedCount: 0, repliesCount: 0, roles: { '87818': { id: '87818', isDefault: true, name: 'Members', permissions: {}, }, }, type: 3, }, '87837': { color: '6d49ab', community: '1', containingThreadID: '86071', creationTime: 1682368041060, currentUser: { permissions: { add_members: { source: '87837', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: '87837', value: true, }, edit_permissions: { source: '87837', value: true, }, edit_thread: { source: '87837', value: true, }, edit_thread_avatar: { source: '87837', value: true, }, edit_thread_color: { source: '87837', value: true, }, edit_thread_description: { source: '87837', value: true, }, join_thread: { source: '86071', value: true, }, know_of: { source: '86071', value: true, }, leave_thread: { source: '87837', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87837', value: true, }, remove_members: { source: '87837', value: true, }, visible: { source: '86071', value: true, }, voiced: { source: '87837', value: true, }, }, role: '87838', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87837', members: [ { id: '256', isSender: false, permissions: { add_members: { source: '1', value: true, }, change_role: { source: '1', value: true, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: '1', value: true, }, edit_entries: { source: '1', value: true, }, edit_message: { source: null, value: false, }, edit_permissions: { source: '1', value: true, }, edit_thread: { source: '1', value: true, }, edit_thread_avatar: { source: '1', value: true, }, edit_thread_color: { source: '1', value: true, }, edit_thread_description: { source: '1', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: '1', value: true, }, react_to_message: { source: null, value: false, }, remove_members: { source: '1', value: true, }, visible: { source: '1', value: true, }, voiced: { source: '1', value: true, }, }, role: null, }, { id: '84589', isSender: true, permissions: { add_members: { source: '87837', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: '87837', value: true, }, edit_permissions: { source: '87837', value: true, }, edit_thread: { source: '87837', value: true, }, edit_thread_avatar: { source: '87837', value: true, }, edit_thread_color: { source: '87837', value: true, }, edit_thread_description: { source: '87837', value: true, }, join_thread: { source: '86071', value: true, }, know_of: { source: '86071', value: true, }, leave_thread: { source: '87837', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87837', value: true, }, remove_members: { source: '87837', value: true, }, visible: { source: '86071', value: true, }, voiced: { source: '87837', value: true, }, }, role: '87838', }, { id: '85999', isSender: false, permissions: { add_members: { source: '87837', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: '87837', value: true, }, edit_permissions: { source: '87837', value: true, }, edit_thread: { source: '87837', value: true, }, edit_thread_avatar: { source: '87837', value: true, }, edit_thread_color: { source: '87837', value: true, }, edit_thread_description: { source: '87837', value: true, }, join_thread: { source: '86071', value: true, }, know_of: { source: '86071', value: true, }, leave_thread: { source: '87837', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87837', value: true, }, remove_members: { source: '87837', value: true, }, visible: { source: '86071', value: true, }, voiced: { source: '87837', value: true, }, }, role: '87838', }, ], name: 'Hello', parentThreadID: '86071', pinnedCount: 0, repliesCount: 1, roles: { '87838': { id: '87838', isDefault: true, name: 'Members', permissions: {}, }, }, sourceMessageID: '86339', type: 5, }, }; // Clear out contents of role permissions AND member permissions to // ensure `updateRolesAndPermissions` constructs them properly // without dependingon anything from existing store. const threadStoreThreadsWithEmptyRolePermissionsAndMemberPermissions: ThreadStoreThreadInfos = { '1': { color: 'b8753d', community: null, containingThreadID: null, creationTime: 1679537878106, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: null, value: false, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: null, value: false, }, edit_thread_description: { source: null, value: false, }, join_thread: { source: null, value: false, }, know_of: { source: '1', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: null, value: false, }, remove_members: { source: null, value: false, }, visible: { source: '1', value: true, }, voiced: { source: null, value: false, }, }, role: '83795', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: 'This is the first community on Comm. In the future it will be possible to create chats outside of a community, but for now all of these chats get set with GENESIS as their parent. GENESIS is hosted on Ashoat’s keyserver.', id: '1', members: [ { id: '256', isSender: false, permissions: {}, role: '83796', }, { id: '84589', isSender: false, permissions: {}, role: '83795', }, ], name: 'GENESIS', parentThreadID: null, pinnedCount: 0, repliesCount: 0, roles: { '83795': { id: '83795', isDefault: true, name: 'Members', permissions: {}, }, '83796': { id: '83796', isDefault: false, name: 'Admins', permissions: {}, }, }, type: 12, }, '84596': { color: '575757', community: '1', containingThreadID: '1', creationTime: 1680734420100, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84596', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84596', value: true, }, edit_message: { source: '84596', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: null, value: false, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84596', value: true, }, edit_thread_description: { source: '84596', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84596', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84596', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84596', value: true, }, voiced: { source: '84596', value: true, }, }, role: '84597', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: 'This is your private chat, where you can set reminders and jot notes in private!', id: '84596', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '84589', isSender: false, permissions: {}, role: '84597', }, ], name: 'hillary', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84597': { id: '84597', isDefault: true, name: 'Members', permissions: {}, }, }, type: 7, }, '84598': { color: '5c9f5f', community: '1', containingThreadID: '1', creationTime: 1680734420159, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84598', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84598', value: true, }, edit_message: { source: '84598', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84598', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84598', value: true, }, edit_thread_description: { source: '84598', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84598', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84598', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84598', value: true, }, voiced: { source: '84598', value: true, }, }, role: '84599', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84598', members: [ { id: '256', isSender: true, permissions: {}, role: '84599', }, { id: '84589', isSender: false, permissions: {}, role: '84599', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84599': { id: '84599', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '84627': { color: 'aa4b4b', community: '1', containingThreadID: '1', creationTime: 1680734427175, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84627', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84627', value: true, }, edit_message: { source: '84627', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '84627', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '84627', value: true, }, edit_thread_description: { source: '84627', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84627', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84627', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '84627', value: true, }, voiced: { source: '84627', value: true, }, }, role: '84628', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84627', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '83969', isSender: false, permissions: {}, role: '84628', }, { id: '84589', isSender: false, permissions: {}, role: '84628', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84628': { id: '84628', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '84656': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1680734490721, currentUser: { permissions: { add_members: { source: '84656', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '84656', value: true, }, create_subthreads: { source: '84656', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '84656', value: true, }, edit_message: { source: '84656', value: true, }, edit_permissions: { source: '84656', value: true, }, edit_thread: { source: '84656', value: true, }, edit_thread_avatar: { source: '84656', value: true, }, edit_thread_color: { source: '84656', value: true, }, edit_thread_description: { source: '84656', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '84656', value: true, }, leave_thread: { source: '84656', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '84656', value: true, }, remove_members: { source: '84656', value: true, }, visible: { source: '84656', value: true, }, voiced: { source: '84656', value: true, }, }, role: '84657', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84656', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '83809', isSender: true, permissions: {}, role: '84657', }, { id: '83969', isSender: true, permissions: {}, role: '84657', }, { id: '84589', isSender: false, permissions: {}, role: '84657', }, ], name: 'group', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84657': { id: '84657', isDefault: true, name: 'Members', permissions: {}, }, }, type: 4, }, '86071': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1681160151827, currentUser: { permissions: { add_members: { source: null, value: false, }, change_role: { source: null, value: false, }, create_sidebars: { source: '86071', value: true, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '86071', value: true, }, edit_message: { source: '86071', value: true, }, edit_permissions: { source: null, value: false, }, edit_thread: { source: '86071', value: true, }, edit_thread_avatar: { source: null, value: false, }, edit_thread_color: { source: '86071', value: true, }, edit_thread_description: { source: '86071', value: true, }, join_thread: { source: null, value: false, }, know_of: { source: '86071', value: true, }, leave_thread: { source: null, value: false, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '86071', value: true, }, remove_members: { source: null, value: false, }, visible: { source: '86071', value: true, }, voiced: { source: '86071', value: true, }, }, role: '86072', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '86071', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '84589', isSender: true, permissions: {}, role: '86072', }, { id: '85999', isSender: true, permissions: {}, role: '86072', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '86072': { id: '86072', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '87789': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1682367957349, currentUser: { permissions: { add_members: { source: '87789', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87789', value: true, }, create_subthreads: { source: '87789', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87789', value: true, }, edit_message: { source: '87789', value: true, }, edit_permissions: { source: '87789', value: true, }, edit_thread: { source: '87789', value: true, }, edit_thread_avatar: { source: '87789', value: true, }, edit_thread_color: { source: '87789', value: true, }, edit_thread_description: { source: '87789', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87789', value: true, }, leave_thread: { source: '87789', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87789', value: true, }, remove_members: { source: '87789', value: true, }, visible: { source: '87789', value: true, }, voiced: { source: '87789', value: true, }, }, role: '87790', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87789', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '83809', isSender: false, permissions: {}, role: null, }, { id: '83969', isSender: false, permissions: {}, role: '87790', }, { id: '84589', isSender: false, permissions: {}, role: '87790', }, ], name: 'Subthread', parentThreadID: '84656', pinnedCount: 0, repliesCount: 0, roles: { '87790': { id: '87790', isDefault: true, name: 'Members', permissions: {}, }, }, type: 3, }, '87817': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1682368005862, currentUser: { permissions: { add_members: { source: '87817', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: '87817', value: true, }, create_subthreads: { source: '87817', value: true, }, delete_thread: { source: null, value: false, }, edit_entries: { source: '87817', value: true, }, edit_message: { source: '87817', value: true, }, edit_permissions: { source: '87817', value: true, }, edit_thread: { source: '87817', value: true, }, edit_thread_avatar: { source: '87817', value: true, }, edit_thread_color: { source: '87817', value: true, }, edit_thread_description: { source: '87817', value: true, }, join_thread: { source: '84656', value: true, }, know_of: { source: '87817', value: true, }, leave_thread: { source: '87817', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87817', value: true, }, remove_members: { source: '87817', value: true, }, visible: { source: '87817', value: true, }, voiced: { source: '87817', value: true, }, }, role: '87818', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87817', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '83809', isSender: false, permissions: {}, role: null, }, { id: '83969', isSender: false, permissions: {}, role: '87818', }, { id: '84589', isSender: true, permissions: {}, role: '87818', }, ], name: '', parentThreadID: '84656', pinnedCount: 0, repliesCount: 0, roles: { '87818': { id: '87818', isDefault: true, name: 'Members', permissions: {}, }, }, type: 3, }, '87837': { color: '6d49ab', community: '1', containingThreadID: '86071', creationTime: 1682368041060, currentUser: { permissions: { add_members: { source: '87837', value: true, }, change_role: { source: null, value: false, }, create_sidebars: { source: null, value: false, }, create_subthreads: { source: null, value: false, }, delete_thread: { source: null, value: false, }, edit_entries: { source: null, value: false, }, edit_message: { source: '87837', value: true, }, edit_permissions: { source: '87837', value: true, }, edit_thread: { source: '87837', value: true, }, edit_thread_avatar: { source: '87837', value: true, }, edit_thread_color: { source: '87837', value: true, }, edit_thread_description: { source: '87837', value: true, }, join_thread: { source: '86071', value: true, }, know_of: { source: '86071', value: true, }, leave_thread: { source: '87837', value: true, }, manage_pins: { source: null, value: false, }, react_to_message: { source: '87837', value: true, }, remove_members: { source: '87837', value: true, }, visible: { source: '86071', value: true, }, voiced: { source: '87837', value: true, }, }, role: '87838', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87837', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '84589', isSender: true, permissions: {}, role: '87838', }, { id: '85999', isSender: false, permissions: {}, role: '87838', }, ], name: 'Hello', parentThreadID: '86071', pinnedCount: 0, repliesCount: 1, roles: { '87838': { id: '87838', isDefault: true, name: 'Members', permissions: {}, }, }, sourceMessageID: '86339', type: 5, }, }; // Clear out contents of role permissions AND member permissions // AND current member permissions to ensure `updateRolesAndPermissions` // constructs them properly without dependingon anything from existing store. const threadStoreThreadsWithEmptyRoleAndMemberAndCurrentUserPermissions: ThreadStoreThreadInfos = { '1': { color: 'b8753d', community: null, containingThreadID: null, creationTime: 1679537878106, currentUser: { permissions: {}, role: '83795', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: 'This is the first community on Comm. In the future it will be possible to create chats outside of a community, but for now all of these chats get set with GENESIS as their parent. GENESIS is hosted on Ashoat’s keyserver.', id: '1', members: [ { id: '256', isSender: false, permissions: {}, role: '83796', }, { id: '84589', isSender: false, permissions: {}, role: '83795', }, ], name: 'GENESIS', parentThreadID: null, pinnedCount: 0, repliesCount: 0, roles: { '83795': { id: '83795', isDefault: true, name: 'Members', permissions: {}, }, '83796': { id: '83796', isDefault: false, name: 'Admins', permissions: {}, }, }, type: 12, }, '84596': { color: '575757', community: '1', containingThreadID: '1', creationTime: 1680734420100, currentUser: { permissions: {}, role: '84597', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: 'This is your private chat, where you can set reminders and jot notes in private!', id: '84596', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '84589', isSender: false, permissions: {}, role: '84597', }, ], name: 'hillary', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84597': { id: '84597', isDefault: true, name: 'Members', permissions: {}, }, }, type: 7, }, '84598': { color: '5c9f5f', community: '1', containingThreadID: '1', creationTime: 1680734420159, currentUser: { permissions: {}, role: '84599', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84598', members: [ { id: '256', isSender: true, permissions: {}, role: '84599', }, { id: '84589', isSender: false, permissions: {}, role: '84599', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84599': { id: '84599', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '84627': { color: 'aa4b4b', community: '1', containingThreadID: '1', creationTime: 1680734427175, currentUser: { permissions: {}, role: '84628', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84627', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '83969', isSender: false, permissions: {}, role: '84628', }, { id: '84589', isSender: false, permissions: {}, role: '84628', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84628': { id: '84628', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '84656': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1680734490721, currentUser: { permissions: {}, role: '84657', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '84656', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '83809', isSender: true, permissions: {}, role: '84657', }, { id: '83969', isSender: true, permissions: {}, role: '84657', }, { id: '84589', isSender: false, permissions: {}, role: '84657', }, ], name: 'group', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '84657': { id: '84657', isDefault: true, name: 'Members', permissions: {}, }, }, type: 4, }, '86071': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1681160151827, currentUser: { permissions: {}, role: '86072', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '86071', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '84589', isSender: true, permissions: {}, role: '86072', }, { id: '85999', isSender: true, permissions: {}, role: '86072', }, ], name: '', parentThreadID: '1', pinnedCount: 0, repliesCount: 0, roles: { '86072': { id: '86072', isDefault: true, name: 'Members', permissions: {}, }, }, type: 6, }, '87789': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1682367957349, currentUser: { permissions: {}, role: '87790', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87789', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '83809', isSender: false, permissions: {}, role: null, }, { id: '83969', isSender: false, permissions: {}, role: '87790', }, { id: '84589', isSender: false, permissions: {}, role: '87790', }, ], name: 'Subthread', parentThreadID: '84656', pinnedCount: 0, repliesCount: 0, roles: { '87790': { id: '87790', isDefault: true, name: 'Members', permissions: {}, }, }, type: 3, }, '87817': { color: '6d49ab', community: '1', containingThreadID: '1', creationTime: 1682368005862, currentUser: { permissions: {}, role: '87818', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87817', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '83809', isSender: false, permissions: {}, role: null, }, { id: '83969', isSender: false, permissions: {}, role: '87818', }, { id: '84589', isSender: true, permissions: {}, role: '87818', }, ], name: '', parentThreadID: '84656', pinnedCount: 0, repliesCount: 0, roles: { '87818': { id: '87818', isDefault: true, name: 'Members', permissions: {}, }, }, type: 3, }, '87837': { color: '6d49ab', community: '1', containingThreadID: '86071', creationTime: 1682368041060, currentUser: { permissions: {}, role: '87838', subscription: { home: true, pushNotifs: true, }, unread: false, }, description: '', id: '87837', members: [ { id: '256', isSender: false, permissions: {}, role: null, }, { id: '84589', isSender: true, permissions: {}, role: '87838', }, { id: '85999', isSender: false, permissions: {}, role: '87838', }, ], name: 'Hello', parentThreadID: '86071', pinnedCount: 0, repliesCount: 1, roles: { '87838': { id: '87838', isDefault: true, name: 'Members', permissions: {}, }, }, sourceMessageID: '86339', type: 5, }, }; +const threadStoreThreadsWithIncorrectPermissions: ThreadStoreThreadInfos = { + '256|84852': { + id: '256|84852', + type: 9, + name: 'Announcement Community', + description: '', + color: '648caa', + creationTime: 1698337006124, + parentThreadID: null, + members: [ + { + id: '256', + role: '256|84854', + permissions: { + know_of: { + value: true, + source: '256|84852', + }, + visible: { + value: true, + source: '256|84852', + }, + voiced: { + value: true, + source: '256|84852', + }, + edit_entries: { + value: true, + source: '256|84852', + }, + edit_thread: { + value: true, + source: '256|84852', + }, + edit_thread_description: { + value: true, + source: '256|84852', + }, + edit_thread_color: { + value: true, + source: '256|84852', + }, + delete_thread: { + value: true, + source: '256|84852', + }, + create_subthreads: { + value: true, + source: '256|84852', + }, + create_sidebars: { + value: true, + source: '256|84852', + }, + join_thread: { + value: false, + source: null, + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|84852', + }, + remove_members: { + value: true, + source: '256|84852', + }, + change_role: { + value: true, + source: '256|84852', + }, + leave_thread: { + value: true, + source: '256|84852', + }, + react_to_message: { + value: true, + source: '256|84852', + }, + edit_message: { + value: true, + source: '256|84852', + }, + edit_thread_avatar: { + value: true, + source: '256|84852', + }, + manage_pins: { + value: true, + source: '256|84852', + }, + manage_invite_links: { + value: true, + source: '256|84852', + }, + }, + isSender: false, + }, + { + id: '83813', + role: '256|84853', + permissions: { + know_of: { + value: true, + source: '256|84852', + }, + visible: { + value: true, + source: '256|84852', + }, + voiced: { + value: true, + source: '256|84852', + }, + edit_entries: { + value: false, + source: null, + }, + edit_thread: { + value: false, + source: null, + }, + edit_thread_description: { + value: false, + source: null, + }, + edit_thread_color: { + value: false, + source: null, + }, + delete_thread: { + value: false, + source: null, + }, + create_subthreads: { + value: false, + source: null, + }, + create_sidebars: { + value: true, + source: '256|84852', + }, + join_thread: { + value: true, + source: '256|84852', + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|84852', + }, + remove_members: { + value: false, + source: null, + }, + change_role: { + value: false, + source: null, + }, + leave_thread: { + value: true, + source: '256|84852', + }, + react_to_message: { + value: true, + source: '256|84852', + }, + edit_message: { + value: true, + source: '256|84852', + }, + edit_thread_avatar: { + value: false, + source: null, + }, + manage_pins: { + value: false, + source: null, + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + isSender: false, + }, + { + id: '83858', + role: '256|84853', + permissions: { + know_of: { + value: true, + source: '256|84852', + }, + visible: { + value: true, + source: '256|84852', + }, + voiced: { + value: true, + source: '256|84852', + }, + edit_entries: { + value: false, + source: null, + }, + edit_thread: { + value: false, + source: null, + }, + edit_thread_description: { + value: false, + source: null, + }, + edit_thread_color: { + value: false, + source: null, + }, + delete_thread: { + value: false, + source: null, + }, + create_subthreads: { + value: false, + source: null, + }, + create_sidebars: { + value: true, + source: '256|84852', + }, + join_thread: { + value: true, + source: '256|84852', + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|84852', + }, + remove_members: { + value: false, + source: null, + }, + change_role: { + value: false, + source: null, + }, + leave_thread: { + value: true, + source: '256|84852', + }, + react_to_message: { + value: true, + source: '256|84852', + }, + edit_message: { + value: true, + source: '256|84852', + }, + edit_thread_avatar: { + value: false, + source: null, + }, + manage_pins: { + value: false, + source: null, + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + isSender: false, + }, + { + id: '83906', + role: '256|84853', + permissions: { + know_of: { + value: true, + source: '256|84852', + }, + visible: { + value: true, + source: '256|84852', + }, + voiced: { + value: true, + source: '256|84852', + }, + edit_entries: { + value: false, + source: null, + }, + edit_thread: { + value: false, + source: null, + }, + edit_thread_description: { + value: false, + source: null, + }, + edit_thread_color: { + value: false, + source: null, + }, + delete_thread: { + value: false, + source: null, + }, + create_subthreads: { + value: false, + source: null, + }, + create_sidebars: { + value: true, + source: '256|84852', + }, + join_thread: { + value: true, + source: '256|84852', + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|84852', + }, + remove_members: { + value: false, + source: null, + }, + change_role: { + value: false, + source: null, + }, + leave_thread: { + value: true, + source: '256|84852', + }, + react_to_message: { + value: true, + source: '256|84852', + }, + edit_message: { + value: true, + source: '256|84852', + }, + edit_thread_avatar: { + value: false, + source: null, + }, + manage_pins: { + value: false, + source: null, + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + isSender: false, + }, + { + id: '83953', + role: '256|84853', + permissions: { + know_of: { + value: true, + source: '256|84852', + }, + visible: { + value: true, + source: '256|84852', + }, + voiced: { + value: true, + source: '256|84852', + }, + edit_entries: { + value: false, + source: null, + }, + edit_thread: { + value: false, + source: null, + }, + edit_thread_description: { + value: false, + source: null, + }, + edit_thread_color: { + value: false, + source: null, + }, + delete_thread: { + value: false, + source: null, + }, + create_subthreads: { + value: false, + source: null, + }, + create_sidebars: { + value: true, + source: '256|84852', + }, + join_thread: { + value: true, + source: '256|84852', + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|84852', + }, + remove_members: { + value: false, + source: null, + }, + change_role: { + value: false, + source: null, + }, + leave_thread: { + value: true, + source: '256|84852', + }, + react_to_message: { + value: true, + source: '256|84852', + }, + edit_message: { + value: true, + source: '256|84852', + }, + edit_thread_avatar: { + value: false, + source: null, + }, + manage_pins: { + value: false, + source: null, + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + isSender: false, + }, + { + id: '84003', + role: '256|84853', + permissions: { + know_of: { + value: true, + source: '256|84852', + }, + visible: { + value: true, + source: '256|84852', + }, + voiced: { + value: true, + source: '256|84852', + }, + edit_entries: { + value: false, + source: null, + }, + edit_thread: { + value: false, + source: null, + }, + edit_thread_description: { + value: false, + source: null, + }, + edit_thread_color: { + value: false, + source: null, + }, + delete_thread: { + value: false, + source: null, + }, + create_subthreads: { + value: false, + source: null, + }, + create_sidebars: { + value: true, + source: '256|84852', + }, + join_thread: { + value: true, + source: '256|84852', + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|84852', + }, + remove_members: { + value: false, + source: null, + }, + change_role: { + value: false, + source: null, + }, + leave_thread: { + value: true, + source: '256|84852', + }, + react_to_message: { + value: true, + source: '256|84852', + }, + edit_message: { + value: true, + source: '256|84852', + }, + edit_thread_avatar: { + value: false, + source: null, + }, + manage_pins: { + value: false, + source: null, + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + isSender: false, + }, + ], + roles: { + '256|84853': { + id: '256|84853', + name: 'Members', + permissions: { + know_of: true, + descendant_open_know_of: true, + visible: true, + descendant_open_visible: true, + join_thread: true, + child_open_join_thread: true, + descendant_opentoplevel_join_thread: true, + create_sidebars: true, + leave_thread: true, + react_to_message: true, + descendant_react_to_message: true, + edit_message: true, + descendant_edit_message: true, + add_members: true, + descendant_add_members: true, + child_open_add_members: true, + voiced: true, + }, + isDefault: true, + }, + '256|84854': { + id: '256|84854', + name: 'Admins', + permissions: { + know_of: true, + visible: true, + voiced: true, + react_to_message: true, + edit_message: true, + edit_entries: true, + edit_thread: true, + edit_thread_color: true, + edit_thread_description: true, + edit_thread_avatar: true, + create_subthreads: true, + create_sidebars: true, + add_members: true, + delete_thread: true, + remove_members: true, + change_role: true, + manage_pins: true, + manage_invite_links: true, + descendant_know_of: true, + descendant_visible: true, + descendant_toplevel_join_thread: true, + child_join_thread: true, + descendant_voiced: true, + descendant_edit_entries: true, + descendant_edit_thread: true, + descendant_edit_thread_color: true, + descendant_edit_thread_description: true, + descendant_edit_thread_avatar: true, + descendant_toplevel_create_subthreads: true, + descendant_toplevel_create_sidebars: true, + descendant_add_members: true, + descendant_delete_thread: true, + descendant_edit_permissions: true, + descendant_remove_members: true, + descendant_change_role: true, + descendant_manage_pins: true, + leave_thread: true, + }, + isDefault: false, + }, + }, + currentUser: { + role: '256|84853', + permissions: { + know_of: { + value: true, + source: '256|84852', + }, + visible: { + value: true, + source: '256|84852', + }, + voiced: { + value: true, + source: '256|84852', + }, + edit_entries: { + value: false, + source: null, + }, + edit_thread: { + value: false, + source: null, + }, + edit_thread_description: { + value: false, + source: null, + }, + edit_thread_color: { + value: false, + source: null, + }, + delete_thread: { + value: false, + source: null, + }, + create_subthreads: { + value: false, + source: null, + }, + create_sidebars: { + value: true, + source: '256|84852', + }, + join_thread: { + value: true, + source: '256|84852', + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|84852', + }, + remove_members: { + value: false, + source: null, + }, + change_role: { + value: false, + source: null, + }, + leave_thread: { + value: true, + source: '256|84852', + }, + react_to_message: { + value: true, + source: '256|84852', + }, + edit_message: { + value: true, + source: '256|84852', + }, + edit_thread_avatar: { + value: false, + source: null, + }, + manage_pins: { + value: false, + source: null, + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + subscription: { + home: true, + pushNotifs: true, + }, + unread: false, + }, + repliesCount: 0, + containingThreadID: null, + community: null, + pinnedCount: 0, + }, + '256|85022': { + id: '256|85022', + type: 8, + name: 'Communications', + description: '', + color: 'aa4b4b', + creationTime: 1698341268486, + parentThreadID: null, + members: [ + { + id: '256', + role: '256|85023', + permissions: { + know_of: { + value: true, + source: '256|85022', + }, + visible: { + value: true, + source: '256|85022', + }, + voiced: { + value: true, + source: '256|85022', + }, + edit_entries: { + value: true, + source: '256|85022', + }, + edit_thread: { + value: true, + source: '256|85022', + }, + edit_thread_description: { + value: true, + source: '256|85022', + }, + edit_thread_color: { + value: true, + source: '256|85022', + }, + delete_thread: { + value: false, + source: null, + }, + create_subthreads: { + value: true, + source: '256|85022', + }, + create_sidebars: { + value: true, + source: '256|85022', + }, + join_thread: { + value: false, + source: null, + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|85022', + }, + remove_members: { + value: false, + source: null, + }, + change_role: { + value: false, + source: null, + }, + leave_thread: { + value: true, + source: '256|85022', + }, + react_to_message: { + value: true, + source: '256|85022', + }, + edit_message: { + value: true, + source: '256|85022', + }, + edit_thread_avatar: { + value: true, + source: '256|85022', + }, + manage_pins: { + value: false, + source: null, + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + isSender: false, + }, + { + id: '83953', + role: '256|85024', + permissions: { + know_of: { + value: true, + source: '256|85022', + }, + visible: { + value: true, + source: '256|85022', + }, + voiced: { + value: true, + source: '256|85022', + }, + edit_entries: { + value: true, + source: '256|85022', + }, + edit_thread: { + value: true, + source: '256|85022', + }, + edit_thread_description: { + value: true, + source: '256|85022', + }, + edit_thread_color: { + value: true, + source: '256|85022', + }, + delete_thread: { + value: true, + source: '256|85022', + }, + create_subthreads: { + value: true, + source: '256|85022', + }, + create_sidebars: { + value: true, + source: '256|85022', + }, + join_thread: { + value: false, + source: null, + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|85022', + }, + remove_members: { + value: true, + source: '256|85022', + }, + change_role: { + value: true, + source: '256|85022', + }, + leave_thread: { + value: true, + source: '256|85022', + }, + react_to_message: { + value: true, + source: '256|85022', + }, + edit_message: { + value: true, + source: '256|85022', + }, + edit_thread_avatar: { + value: true, + source: '256|85022', + }, + manage_pins: { + value: true, + source: '256|85022', + }, + manage_invite_links: { + value: true, + source: '256|85022', + }, + }, + isSender: false, + }, + ], + roles: { + '256|85023': { + id: '256|85023', + name: 'Members', + permissions: { + know_of: true, + visible: true, + descendant_open_know_of: true, + descendant_open_visible: true, + descendant_opentoplevel_join_thread: true, + react_to_message: true, + edit_message: true, + leave_thread: true, + create_sidebars: true, + add_members: true, + child_open_join_thread: true, + child_open_add_members: true, + voiced: true, + edit_entries: true, + edit_thread: true, + edit_thread_color: true, + edit_thread_description: true, + edit_thread_avatar: true, + create_subthreads: true, + }, + isDefault: true, + }, + '256|85024': { + id: '256|85024', + name: 'Admins', + permissions: { + know_of: true, + visible: true, + voiced: true, + react_to_message: true, + edit_message: true, + edit_entries: true, + edit_thread: true, + edit_thread_color: true, + edit_thread_description: true, + edit_thread_avatar: true, + create_subthreads: true, + create_sidebars: true, + add_members: true, + delete_thread: true, + remove_members: true, + change_role: true, + manage_pins: true, + manage_invite_links: true, + descendant_know_of: true, + descendant_visible: true, + descendant_toplevel_join_thread: true, + child_join_thread: true, + descendant_voiced: true, + descendant_edit_entries: true, + descendant_edit_thread: true, + descendant_edit_thread_color: true, + descendant_edit_thread_description: true, + descendant_edit_thread_avatar: true, + descendant_toplevel_create_subthreads: true, + descendant_toplevel_create_sidebars: true, + descendant_add_members: true, + descendant_delete_thread: true, + descendant_edit_permissions: true, + descendant_remove_members: true, + descendant_change_role: true, + descendant_manage_pins: true, + leave_thread: true, + }, + isDefault: false, + }, + '256|85027': { + id: '256|85027', + name: 'Moderators', + permissions: { + know_of: true, + descendant_open_know_of: true, + descendant_open_voiced: true, + visible: true, + descendant_open_visible: true, + join_thread: true, + child_open_join_thread: true, + descendant_opentoplevel_join_thread: true, + create_sidebars: true, + leave_thread: true, + voiced: true, + }, + isDefault: false, + }, + }, + currentUser: { + role: '256|85024', + permissions: { + know_of: { + value: true, + source: '256|85022', + }, + visible: { + value: true, + source: '256|85022', + }, + voiced: { + value: true, + source: '256|85022', + }, + edit_entries: { + value: true, + source: '256|85022', + }, + edit_thread: { + value: true, + source: '256|85022', + }, + edit_thread_description: { + value: true, + source: '256|85022', + }, + edit_thread_color: { + value: true, + source: '256|85022', + }, + delete_thread: { + value: true, + source: '256|85022', + }, + create_subthreads: { + value: true, + source: '256|85022', + }, + create_sidebars: { + value: true, + source: '256|85022', + }, + join_thread: { + value: false, + source: null, + }, + edit_permissions: { + value: false, + source: null, + }, + add_members: { + value: true, + source: '256|85022', + }, + remove_members: { + value: true, + source: '256|85022', + }, + change_role: { + value: true, + source: '256|85022', + }, + leave_thread: { + value: true, + source: '256|85022', + }, + react_to_message: { + value: true, + source: '256|85022', + }, + edit_message: { + value: true, + source: '256|85022', + }, + edit_thread_avatar: { + value: true, + source: '256|85022', + }, + manage_pins: { + value: true, + source: '256|85022', + }, + manage_invite_links: { + value: true, + source: '256|85022', + }, + }, + subscription: { + home: true, + pushNotifs: true, + }, + unread: false, + }, + repliesCount: 0, + containingThreadID: null, + community: null, + pinnedCount: 0, + }, + '256|85034': { + id: '256|85034', + type: 3, + name: 'Upcoming Events', + description: '', + color: 'aa4b4b', + creationTime: 1698341321824, + parentThreadID: '256|85022', + members: [ + { + id: '256', + role: '256|85035', + permissions: { + know_of: { + value: true, + source: '256|85034', + }, + visible: { + value: true, + source: '256|85034', + }, + voiced: { + value: true, + source: '256|85034', + }, + edit_entries: { + value: true, + source: '256|85034', + }, + edit_thread: { + value: true, + source: '256|85034', + }, + edit_thread_description: { + value: true, + source: '256|85034', + }, + edit_thread_color: { + value: true, + source: '256|85034', + }, + delete_thread: { + value: false, + source: null, + }, + create_subthreads: { + value: true, + source: '256|85034', + }, + create_sidebars: { + value: true, + source: '256|85034', + }, + join_thread: { + value: true, + source: '256|85022', + }, + edit_permissions: { + value: true, + source: '256|85034', + }, + add_members: { + value: true, + source: '256|85034', + }, + remove_members: { + value: true, + source: '256|85034', + }, + change_role: { + value: false, + source: null, + }, + leave_thread: { + value: true, + source: '256|85034', + }, + react_to_message: { + value: true, + source: '256|85034', + }, + edit_message: { + value: true, + source: '256|85034', + }, + edit_thread_avatar: { + value: true, + source: '256|85034', + }, + manage_pins: { + value: false, + source: null, + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + isSender: false, + }, + { + id: '83953', + role: '256|85035', + permissions: { + know_of: { + value: true, + source: '256|85034', + }, + visible: { + value: true, + source: '256|85034', + }, + voiced: { + value: true, + source: '256|85034', + }, + edit_entries: { + value: true, + source: '256|85034', + }, + edit_thread: { + value: true, + source: '256|85034', + }, + edit_thread_description: { + value: true, + source: '256|85034', + }, + edit_thread_color: { + value: true, + source: '256|85034', + }, + delete_thread: { + value: true, + source: '256|85022', + }, + create_subthreads: { + value: true, + source: '256|85034', + }, + create_sidebars: { + value: true, + source: '256|85034', + }, + join_thread: { + value: true, + source: '256|85022', + }, + edit_permissions: { + value: true, + source: '256|85034', + }, + add_members: { + value: true, + source: '256|85034', + }, + remove_members: { + value: true, + source: '256|85034', + }, + change_role: { + value: true, + source: '256|85022', + }, + leave_thread: { + value: true, + source: '256|85034', + }, + react_to_message: { + value: true, + source: '256|85034', + }, + edit_message: { + value: true, + source: '256|85034', + }, + edit_thread_avatar: { + value: true, + source: '256|85034', + }, + manage_pins: { + value: true, + source: '256|85022', + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + isSender: false, + }, + ], + roles: { + '256|85035': { + id: '256|85035', + name: 'Members', + permissions: { + remove_members: true, + edit_permissions: true, + know_of: true, + visible: true, + react_to_message: true, + edit_message: true, + create_sidebars: true, + leave_thread: true, + descendant_open_know_of: true, + descendant_open_visible: true, + descendant_opentoplevel_join_thread: true, + child_open_join_thread: true, + voiced: true, + edit_entries: true, + edit_thread: true, + edit_thread_color: true, + edit_thread_description: true, + edit_thread_avatar: true, + create_subthreads: true, + add_members: true, + }, + isDefault: true, + }, + }, + currentUser: { + role: '256|85035', + permissions: { + know_of: { + value: true, + source: '256|85034', + }, + visible: { + value: true, + source: '256|85034', + }, + voiced: { + value: true, + source: '256|85034', + }, + edit_entries: { + value: true, + source: '256|85034', + }, + edit_thread: { + value: true, + source: '256|85034', + }, + edit_thread_description: { + value: true, + source: '256|85034', + }, + edit_thread_color: { + value: true, + source: '256|85034', + }, + delete_thread: { + value: true, + source: '256|85022', + }, + create_subthreads: { + value: true, + source: '256|85034', + }, + create_sidebars: { + value: true, + source: '256|85034', + }, + join_thread: { + value: true, + source: '256|85022', + }, + edit_permissions: { + value: true, + source: '256|85034', + }, + add_members: { + value: true, + source: '256|85034', + }, + remove_members: { + value: true, + source: '256|85034', + }, + change_role: { + value: true, + source: '256|85022', + }, + leave_thread: { + value: true, + source: '256|85034', + }, + react_to_message: { + value: true, + source: '256|85034', + }, + edit_message: { + value: true, + source: '256|85034', + }, + edit_thread_avatar: { + value: true, + source: '256|85034', + }, + manage_pins: { + value: true, + source: '256|85022', + }, + manage_invite_links: { + value: false, + source: null, + }, + }, + subscription: { + home: true, + pushNotifs: true, + }, + unread: false, + }, + repliesCount: 0, + containingThreadID: '256|85022', + community: '256|85022', + pinnedCount: 0, + }, +}; + export { threadStoreThreads, threadStoreThreadsWithEmptyRolePermissions, threadStoreThreadsWithEmptyRolePermissionsAndMemberPermissions, threadStoreThreadsWithEmptyRoleAndMemberAndCurrentUserPermissions, + threadStoreThreadsWithIncorrectPermissions, };