* WS Events, Actions, Queries, Thread Follow, Post Query * i18n changes * Misc * Only unread threads are marked as read * Mark threads from WS even as visible in Global threads * Merge fixes * Update thread_post_list.tsx * Merge fix * Feedback fix * Make teamId in handleThreads optional for unfollowed threads * Removed unwated type and return * Review changes * Removing unused model * Merge fix * Misc fixes * Following button query change
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Config, Preferences} from '@constants';
|
|
import {getPreferenceValue} from '@helpers/api/preference';
|
|
|
|
import type PreferenceModel from '@typings/database/models/servers/preference';
|
|
|
|
export function isCRTEnabled(preferences: PreferenceModel[], config?: ClientConfig): boolean {
|
|
let preferenceDefault = Preferences.COLLAPSED_REPLY_THREADS_OFF;
|
|
const configValue = config?.CollapsedThreads;
|
|
if (configValue === Config.DEFAULT_ON) {
|
|
preferenceDefault = Preferences.COLLAPSED_REPLY_THREADS_ON;
|
|
}
|
|
const preference = getPreferenceValue(preferences, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.COLLAPSED_REPLY_THREADS, preferenceDefault);
|
|
|
|
const isAllowed = (
|
|
config?.FeatureFlagCollapsedThreads === Config.TRUE &&
|
|
config?.CollapsedThreads !== Config.DISABLED
|
|
);
|
|
|
|
return isAllowed && (
|
|
preference === Preferences.COLLAPSED_REPLY_THREADS_ON ||
|
|
config?.CollapsedThreads === Config.ALWAYS_ON
|
|
);
|
|
}
|