mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 10:19:08 +00:00
24 lines
721 B
TypeScript
24 lines
721 B
TypeScript
// Copyright 2022 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import type { ConversationType } from '../state/ducks/conversations.preload.js';
|
|
import { StorySendMode } from '../types/Stories.std.js';
|
|
import { assertDev } from './assert.std.js';
|
|
|
|
export function isGroupInStoryMode(
|
|
{ id, type, storySendMode }: ConversationType,
|
|
conversationIdsWithStories: Set<string>
|
|
): boolean {
|
|
if (type !== 'group') {
|
|
return false;
|
|
}
|
|
assertDev(
|
|
storySendMode !== undefined,
|
|
'isGroupInStoryMode: groups must have storySendMode field'
|
|
);
|
|
if (storySendMode === StorySendMode.IfActive) {
|
|
return conversationIdsWithStories.has(id);
|
|
}
|
|
return storySendMode === StorySendMode.Always;
|
|
}
|