Skip to content

Commit

Permalink
Merge pull request #41301 from nextcloud/fix/files_sharing--translations
Browse files Browse the repository at this point in the history
fix(files_sharing): fix sharing tab translations
  • Loading branch information
susnux authored Nov 6, 2023
2 parents 4f48433 + eb9257b commit d056bd5
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 26 deletions.
35 changes: 16 additions & 19 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
button-variant-grouped="vertical"
@update:checked="expandCustomPermissions">
{{ t('files_sharing', 'Custom permissions') }}
<small>{{ t('files_sharing', customPermissionsList) }}</small>
<small>{{ customPermissionsList }}</small>
<template #icon>
<DotsHorizontalIcon :size="20" />
</template>
Expand Down Expand Up @@ -206,6 +206,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'
Expand Down Expand Up @@ -626,26 +628,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')
}
if (hasPermissions(this.share.permissions, ATOMIC_PERMISSIONS.UPDATE)) {
perms.push('update')
// 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.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: {
Expand Down
1 change: 0 additions & 1 deletion dist/4978-4978.js.map

This file was deleted.

6 changes: 3 additions & 3 deletions dist/4978-4978.js → dist/6654-6654.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/6654-6654.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

0 comments on commit d056bd5

Please sign in to comment.