Support for creating New Groups
This commit is contained in:
parent
1934120e46
commit
5de4babc0d
56 changed files with 6222 additions and 526 deletions
29
ts/groups/limits.ts
Normal file
29
ts/groups/limits.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { isNumber } from 'lodash';
|
||||
import { parseIntOrThrow } from '../util/parseIntOrThrow';
|
||||
import { getValue, ConfigKeyType } from '../RemoteConfig';
|
||||
|
||||
function makeGetter(configKey: ConfigKeyType): (fallback?: number) => number {
|
||||
return fallback => {
|
||||
try {
|
||||
return parseIntOrThrow(
|
||||
getValue(configKey),
|
||||
'Failed to parse group size limit'
|
||||
);
|
||||
} catch (err) {
|
||||
if (isNumber(fallback)) {
|
||||
return fallback;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const getGroupSizeRecommendedLimit = makeGetter(
|
||||
'global.groupsv2.maxGroupSize'
|
||||
);
|
||||
export const getGroupSizeHardLimit = makeGetter(
|
||||
'global.groupsv2.groupSizeHardLimit'
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue