diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -373,7 +373,10 @@ } function threadIsPendingSidebar(threadID: ?string): boolean { - return !!threadID?.startsWith('pending/sidebar/'); + return ( + !!threadID?.startsWith('pending/sidebar/') || + !!threadID?.startsWith('pending/dm_sidebar') + ); } function getSingleOtherUser( diff --git a/lib/shared/thread-utils.test.js b/lib/shared/thread-utils.test.js --- a/lib/shared/thread-utils.test.js +++ b/lib/shared/thread-utils.test.js @@ -4,6 +4,7 @@ parsePendingThreadID, threadInfoFromRawThreadInfo, getPendingThreadID, + threadIsPendingSidebar, } from './thread-utils.js'; import { threadInfoValidator } from '../permissions/minimally-encoded-thread-permissions-validators.js'; import type { RawThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; @@ -213,3 +214,28 @@ ).toStrictEqual('pending/dm_sidebar/12345'); }); }); + +describe('threadIsPendingSidebar', () => { + it('should correctly check if sidebar is pending', () => { + const thinPendingSidebarID = getPendingThreadID( + threadTypes.SIDEBAR, + [], + '12345', + ); + const thickPendingSidebarID = getPendingThreadID( + threadTypes.THICK_SIDEBAR, + [], + '12345', + ); + const nonSidebarPendinThreadID = getPendingThreadID( + threadTypes.PERSONAL, + [], + ); + + expect(threadIsPendingSidebar(thinPendingSidebarID)).toStrictEqual(true); + expect(threadIsPendingSidebar(thickPendingSidebarID)).toStrictEqual(true); + expect(threadIsPendingSidebar(nonSidebarPendinThreadID)).toStrictEqual( + false, + ); + }); +});