diff options
author | Grigorii K. Shartsev <me@shgk.me> | 2023-11-06 13:58:30 +0100 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2023-11-25 08:24:46 +0100 |
commit | b43325fb434758fbbec45c574731f603cac20a26 (patch) | |
tree | 63baec36a329df75efc8018babfa53ee54440bac /apps | |
parent | 93b8e662ad5d02b70718a69c6208312a7466778a (diff) | |
download | nextcloud-server-b43325fb434758fbbec45c574731f603cac20a26.tar.gz nextcloud-server-b43325fb434758fbbec45c574731f603cac20a26.zip |
fix(files_sharing): permissions translation
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/src/views/SharingDetailsTab.vue | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index 9306a0b5217..a06af89a9d0 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -64,9 +64,11 @@ type="radio" button-variant-grouped="vertical" @update:checked="expandCustomPermissions"> - <DotsHorizontalIcon :size="20" /> - <span>{{ t('files_sharing', 'Custom permissions') }}</span> - <small>{{ t('files_sharing', customPermissionsList) }}</small> + {{ t('files_sharing', 'Custom permissions') }} + <small>{{ customPermissionsList }}</small> + <template #icon> + <DotsHorizontalIcon :size="20" /> + </template> </NcCheckboxRadioSwitch> </div> </div> @@ -194,6 +196,8 @@ </template> <script> +import { getLanguage } from '@nextcloud/l10n' + import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import NcInputField from '@nextcloud/vue/dist/Components/NcInputField.js' import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js' @@ -611,26 +615,21 @@ export default { return this.fileInfo.shareAttributes.some(hasDisabledDownload) }, customPermissionsList() { - const perms = [] - if (hasPermissions(this.share.permissions, ATOMIC_PERMISSIONS.READ)) { - perms.push('read') - } - if (hasPermissions(this.share.permissions, ATOMIC_PERMISSIONS.CREATE)) { - perms.push('create') + // Key order will be different, because ATOMIC_PERMISSIONS are numbers + const translatedPermissions = { + [ATOMIC_PERMISSIONS.READ]: this.t('files_sharing', 'Read'), + [ATOMIC_PERMISSIONS.CREATE]: this.t('files_sharing', 'Create'), + [ATOMIC_PERMISSIONS.UPDATE]: this.t('files_sharing', 'Update'), + [ATOMIC_PERMISSIONS.SHARE]: this.t('files_sharing', 'Share'), + [ATOMIC_PERMISSIONS.DELETE]: this.t('files_sharing', 'Delete'), } - if (hasPermissions(this.share.permissions, ATOMIC_PERMISSIONS.UPDATE)) { - perms.push('update') - } - if (hasPermissions(this.share.permissions, ATOMIC_PERMISSIONS.DELETE)) { - perms.push('delete') - } - if (hasPermissions(this.share.permissions, ATOMIC_PERMISSIONS.SHARE)) { - perms.push('share') - } - const capitalizeFirstAndJoin = array => array.map((item, index) => index === 0 ? item[0].toUpperCase() + item.substring(1) : item).join(', ') - - return capitalizeFirstAndJoin(perms) + return [ATOMIC_PERMISSIONS.READ, ATOMIC_PERMISSIONS.CREATE, ATOMIC_PERMISSIONS.UPDATE, ATOMIC_PERMISSIONS.SHARE, ATOMIC_PERMISSIONS.DELETE] + .filter((permission) => hasPermissions(this.share.permissions, permission)) + .map((permission, index) => index === 0 + ? translatedPermissions[permission] + : translatedPermissions[permission].toLocaleLowerCase(getLanguage())) + .join(', ') }, }, watch: { |