diff --git a/ts/RemoteConfig.ts b/ts/RemoteConfig.ts index 070d1d752..ca33441e0 100644 --- a/ts/RemoteConfig.ts +++ b/ts/RemoteConfig.ts @@ -5,6 +5,7 @@ import { get, throttle } from 'lodash'; import { connectToServerWithStoredCredentials } from './util/connectToServerWithStoredCredentials'; export type ConfigKeyType = + | 'desktop.announcementGroup' | 'desktop.clientExpiration' | 'desktop.disableGV1' | 'desktop.groupCalling' diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index e0d80c534..e9ee532f8 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -81,6 +81,7 @@ import { } from '../state/selectors/message'; import { Deletes } from '../messageModifiers/Deletes'; import { Reactions, ReactionModel } from '../messageModifiers/Reactions'; +import { isAnnouncementGroupReady } from '../util/isAnnouncementGroupReady'; // TODO: remove once we move away from ArrayBuffers const FIXMEU8 = Uint8Array; @@ -3016,6 +3017,10 @@ export class ConversationModel extends window.Backbone return false; } + if (!isAnnouncementGroupReady()) { + return false; + } + const members = getConversationMembers(this.attributes); return members.every(conversationAttrs => Boolean(conversationAttrs.capabilities?.announcementGroup) diff --git a/ts/util/isAnnouncementGroupReady.ts b/ts/util/isAnnouncementGroupReady.ts new file mode 100644 index 000000000..ebeae2fd4 --- /dev/null +++ b/ts/util/isAnnouncementGroupReady.ts @@ -0,0 +1,11 @@ +// Copyright 2021 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +import * as RemoteConfig from '../RemoteConfig'; + +export function isAnnouncementGroupReady(): boolean { + return Boolean( + RemoteConfig.isEnabled('desktop.worksAtSignal') || + RemoteConfig.isEnabled('desktop.announcementGroup') + ); +}