diff --git a/lib/utils/message-pinning-utils.js b/lib/utils/message-pinning-utils.js index cab30ba76..4d8100ec7 100644 --- a/lib/utils/message-pinning-utils.js +++ b/lib/utils/message-pinning-utils.js @@ -1,48 +1,48 @@ // @flow import { isInvalidPinSourceForThread } from '../shared/message-utils.js'; import { threadHasPermission, useThreadHasPermission, } from '../shared/thread-utils.js'; import type { MessageInfo, RawMessageInfo } from '../types/message-types.js'; import type { ThreadInfo, RawThreadInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; import type { LegacyRawThreadInfo } from '../types/thread-types.js'; function canToggleMessagePin( - messageInfo: RawMessageInfo | MessageInfo, - threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, + messageInfo: RawMessageInfo, + threadInfo: LegacyRawThreadInfo | RawThreadInfo, ): boolean { const isValidMessage = !isInvalidPinSourceForThread(messageInfo, threadInfo); const hasManagePinsPermission = threadHasPermission( threadInfo, threadPermissions.MANAGE_PINS, ); return isValidMessage && hasManagePinsPermission; } function useCanToggleMessagePin( - messageInfo: RawMessageInfo | MessageInfo, + messageInfo: MessageInfo, threadInfo: ThreadInfo, ): boolean { const isValidMessage = !isInvalidPinSourceForThread(messageInfo, threadInfo); const hasManagePinsPermission = useThreadHasPermission( threadInfo, threadPermissions.MANAGE_PINS, ); return isValidMessage && hasManagePinsPermission; } function pinnedMessageCountText(pinnedCount: number): string { const messageNoun = pinnedCount === 1 ? 'message' : 'messages'; return `${pinnedCount} pinned ${messageNoun}`; } export { canToggleMessagePin, useCanToggleMessagePin, pinnedMessageCountText };