Autoarchive: Fix displaying option in settings (#2692)
This commit is contained in:
parent
515394d35e
commit
9cd1e8bbcc
@ -36,6 +36,7 @@ export interface GramJsAppConfig extends LimitsConfig {
|
|||||||
premium_promo_order: string[];
|
premium_promo_order: string[];
|
||||||
default_emoji_statuses_stickerset_id: string;
|
default_emoji_statuses_stickerset_id: string;
|
||||||
hidden_members_group_size_min: number;
|
hidden_members_group_size_min: number;
|
||||||
|
autoarchive_setting_available: boolean;
|
||||||
// Forums
|
// Forums
|
||||||
topics_pinned_limit: number;
|
topics_pinned_limit: number;
|
||||||
}
|
}
|
||||||
@ -86,6 +87,7 @@ export function buildAppConfig(json: GramJs.TypeJSONValue): ApiAppConfig {
|
|||||||
maxUserReactionsDefault: appConfig.reactions_user_max_default,
|
maxUserReactionsDefault: appConfig.reactions_user_max_default,
|
||||||
maxUserReactionsPremium: appConfig.reactions_user_max_premium,
|
maxUserReactionsPremium: appConfig.reactions_user_max_premium,
|
||||||
hiddenMembersMinCount: appConfig.hidden_members_group_size_min,
|
hiddenMembersMinCount: appConfig.hidden_members_group_size_min,
|
||||||
|
canDisplayAutoarchiveSetting: appConfig.autoarchive_setting_available,
|
||||||
limits: {
|
limits: {
|
||||||
uploadMaxFileparts: getLimit(appConfig, 'upload_max_fileparts', 'uploadMaxFileparts'),
|
uploadMaxFileparts: getLimit(appConfig, 'upload_max_fileparts', 'uploadMaxFileparts'),
|
||||||
stickersFaved: getLimit(appConfig, 'stickers_faved_limit', 'stickersFaved'),
|
stickersFaved: getLimit(appConfig, 'stickers_faved_limit', 'stickersFaved'),
|
||||||
|
|||||||
@ -186,6 +186,7 @@ export interface ApiAppConfig {
|
|||||||
maxUserReactionsPremium: number;
|
maxUserReactionsPremium: number;
|
||||||
hiddenMembersMinCount: number;
|
hiddenMembersMinCount: number;
|
||||||
limits: Record<ApiLimitType, readonly [number, number]>;
|
limits: Record<ApiLimitType, readonly [number, number]>;
|
||||||
|
canDisplayAutoarchiveSetting: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApiConfig {
|
export interface ApiConfig {
|
||||||
|
|||||||
@ -27,6 +27,7 @@ type StateProps = {
|
|||||||
webAuthCount: number;
|
webAuthCount: number;
|
||||||
isSensitiveEnabled?: boolean;
|
isSensitiveEnabled?: boolean;
|
||||||
canChangeSensitive?: boolean;
|
canChangeSensitive?: boolean;
|
||||||
|
canDisplayAutoarchiveSetting: boolean;
|
||||||
shouldArchiveAndMuteNewNonContact?: boolean;
|
shouldArchiveAndMuteNewNonContact?: boolean;
|
||||||
privacyPhoneNumber?: ApiPrivacySettings;
|
privacyPhoneNumber?: ApiPrivacySettings;
|
||||||
privacyLastSeen?: ApiPrivacySettings;
|
privacyLastSeen?: ApiPrivacySettings;
|
||||||
@ -47,6 +48,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
webAuthCount,
|
webAuthCount,
|
||||||
isSensitiveEnabled,
|
isSensitiveEnabled,
|
||||||
canChangeSensitive,
|
canChangeSensitive,
|
||||||
|
canDisplayAutoarchiveSetting,
|
||||||
shouldArchiveAndMuteNewNonContact,
|
shouldArchiveAndMuteNewNonContact,
|
||||||
privacyPhoneNumber,
|
privacyPhoneNumber,
|
||||||
privacyLastSeen,
|
privacyLastSeen,
|
||||||
@ -300,17 +302,19 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="settings-item">
|
{canDisplayAutoarchiveSetting && (
|
||||||
<h4 className="settings-item-header" dir={lang.isRtl ? 'rtl' : undefined}>
|
<div className="settings-item">
|
||||||
{lang('NewChatsFromNonContacts')}
|
<h4 className="settings-item-header" dir={lang.isRtl ? 'rtl' : undefined}>
|
||||||
</h4>
|
{lang('NewChatsFromNonContacts')}
|
||||||
<Checkbox
|
</h4>
|
||||||
label={lang('ArchiveAndMute')}
|
<Checkbox
|
||||||
subLabel={lang('ArchiveAndMuteInfo')}
|
label={lang('ArchiveAndMute')}
|
||||||
checked={Boolean(shouldArchiveAndMuteNewNonContact)}
|
subLabel={lang('ArchiveAndMuteInfo')}
|
||||||
onCheck={handleArchiveAndMuteChange}
|
checked={Boolean(shouldArchiveAndMuteNewNonContact)}
|
||||||
/>
|
onCheck={handleArchiveAndMuteChange}
|
||||||
</div>
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{canChangeSensitive && (
|
{canChangeSensitive && (
|
||||||
<div className="settings-item">
|
<div className="settings-item">
|
||||||
@ -343,6 +347,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
passcode: {
|
passcode: {
|
||||||
hasPasscode,
|
hasPasscode,
|
||||||
},
|
},
|
||||||
|
appConfig,
|
||||||
} = global;
|
} = global;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -352,6 +357,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
blockedCount: blocked.totalCount,
|
blockedCount: blocked.totalCount,
|
||||||
webAuthCount: global.activeWebSessions.orderedHashes.length,
|
webAuthCount: global.activeWebSessions.orderedHashes.length,
|
||||||
isSensitiveEnabled,
|
isSensitiveEnabled,
|
||||||
|
canDisplayAutoarchiveSetting: Boolean(appConfig?.canDisplayAutoarchiveSetting),
|
||||||
shouldArchiveAndMuteNewNonContact,
|
shouldArchiveAndMuteNewNonContact,
|
||||||
canChangeSensitive,
|
canChangeSensitive,
|
||||||
privacyPhoneNumber: privacy.phoneNumber,
|
privacyPhoneNumber: privacy.phoneNumber,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user