Add support for no device limit on links (#1337)

This commit is contained in:
Neeraj Gupta 2023-09-02 16:06:24 +05:30 committed by GitHub
commit bbe28c8a17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -393,6 +393,7 @@
"LINK_PASSWORD_LOCK": "Password lock",
"PUBLIC_COLLECT": "Allow adding photos",
"LINK_DEVICE_LIMIT": "Device limit",
"NO_DEVICE_LIMIT": "None",
"LINK_EXPIRY": "Link expiry",
"NEVER": "Never",
"DISABLE_FILE_DOWNLOAD": "Disable download",

View file

@ -56,7 +56,11 @@ export function ManageDeviceLimit({
<EnteMenuItem
label={t('LINK_DEVICE_LIMIT')}
variant="captioned"
subText={publicShareProp.deviceLimit.toString()}
subText={
publicShareProp.deviceLimit === 0
? t('NO_DEVICE_LIMIT')
: publicShareProp.deviceLimit.toString()
}
onClick={openDeviceLimitChangeModalView}
endIcon={<ChevronRight />}
/>

View file

@ -134,11 +134,12 @@ export function appendCollectionKeyToShareURL(
}
const _intSelectOption = (i: number) => {
return { label: i.toString(), value: i };
const label = i === 0 ? t('NO_DEVICE_LIMIT') : i.toString();
return { label, value: i };
};
export function getDeviceLimitOptions() {
return [2, 5, 10, 25, 50].map((i) => _intSelectOption(i));
return [0, 2, 5, 10, 25, 50].map((i) => _intSelectOption(i));
}
export const shareExpiryOptions = () => [