diff options
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/l10n/cs.js | 2 | ||||
-rw-r--r-- | apps/files_sharing/l10n/cs.json | 2 | ||||
-rw-r--r-- | apps/files_sharing/l10n/de.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/de.json | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/de_DE.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/de_DE.json | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/en_GB.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/en_GB.json | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/fr.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/fr.json | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/pt_BR.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/pt_BR.json | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/zh_CN.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/zh_CN.json | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/zh_HK.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/zh_HK.json | 1 | ||||
-rw-r--r-- | apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php | 8 | ||||
-rw-r--r-- | apps/files_sharing/src/files_views/publicFileDrop.ts | 7 | ||||
-rw-r--r-- | apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue | 93 | ||||
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareControllerTest.php | 24 |
20 files changed, 125 insertions, 25 deletions
diff --git a/apps/files_sharing/l10n/cs.js b/apps/files_sharing/l10n/cs.js index 342b9e4f588..97cb49425d6 100644 --- a/apps/files_sharing/l10n/cs.js +++ b/apps/files_sharing/l10n/cs.js @@ -257,6 +257,7 @@ OC.L10N.register( "File drop" : "Předání souboru", "Upload files to {foldername}." : "Nahrát soubory do {foldername}", "By uploading files, you agree to the terms of service." : "Nahráním souborů souhlasíte s podmínkami služby.", + "Successfully uploaded files" : "Soubory úspěšně nahrány", "View terms of service" : "Zobrazit smluvní podmínky", "Terms of service" : "Všeobecné podmínky", "Upload files to {folder}" : "Nahrát soubory do {folder}", @@ -313,6 +314,7 @@ OC.L10N.register( "Use this method to share files with individuals or teams within your organization. If the recipient already has access to the share but cannot locate it, you can send them the internal share link for easy access." : "Tuto metodu použijte pro nasdílení souborů jednotlivcům nebo týmům ve vaší organizaci. Pokud příjemce už má přístup ke sdílení, ale nemůže ho nalézt, můžete mu přístup usnadnit zasláním vnitřního odkazu na sdílení.", "Use this method to share files with individuals or organizations outside your organization. Files and folders can be shared via public share links and email addresses. You can also share to other Nextcloud accounts hosted on different instances using their federated cloud ID." : "Tuto metodu používejte pro sdílení souborů s jednotlivci nebo organizacemi vně té vaší. Soubory a složky je možné nasdílet prostřednictvím veřejných odkazů na sdílení a e-mailových adres. Je také možné nasdílet ostatním Nextcloud účtům hostovaným na různých instancích a to prostřednictvím jejich identifikátorů v rámci federovaného cloudu.", "Shares that are not part of the internal or external shares. This can be shares from apps or other sources." : "Sdílení, která nejsou součástí interních nebo externích sdílení. Toto mohou být sdílení z aplikací nebo jiných zdrojů.", + "Share with accounts, teams, federated cloud IDs" : "Nasdílejte účtům, týmům, identifikátorům v rámci federovaného cloudu", "Share with accounts and teams" : "Nasdílet účtům a týmům", "Email, federated cloud ID" : "E-mail, identif. federovaného cloudu", "Unable to load the shares list" : "Nedaří se načíst seznam sdílení", diff --git a/apps/files_sharing/l10n/cs.json b/apps/files_sharing/l10n/cs.json index 8e6393fd417..b5f512d20e7 100644 --- a/apps/files_sharing/l10n/cs.json +++ b/apps/files_sharing/l10n/cs.json @@ -255,6 +255,7 @@ "File drop" : "Předání souboru", "Upload files to {foldername}." : "Nahrát soubory do {foldername}", "By uploading files, you agree to the terms of service." : "Nahráním souborů souhlasíte s podmínkami služby.", + "Successfully uploaded files" : "Soubory úspěšně nahrány", "View terms of service" : "Zobrazit smluvní podmínky", "Terms of service" : "Všeobecné podmínky", "Upload files to {folder}" : "Nahrát soubory do {folder}", @@ -311,6 +312,7 @@ "Use this method to share files with individuals or teams within your organization. If the recipient already has access to the share but cannot locate it, you can send them the internal share link for easy access." : "Tuto metodu použijte pro nasdílení souborů jednotlivcům nebo týmům ve vaší organizaci. Pokud příjemce už má přístup ke sdílení, ale nemůže ho nalézt, můžete mu přístup usnadnit zasláním vnitřního odkazu na sdílení.", "Use this method to share files with individuals or organizations outside your organization. Files and folders can be shared via public share links and email addresses. You can also share to other Nextcloud accounts hosted on different instances using their federated cloud ID." : "Tuto metodu používejte pro sdílení souborů s jednotlivci nebo organizacemi vně té vaší. Soubory a složky je možné nasdílet prostřednictvím veřejných odkazů na sdílení a e-mailových adres. Je také možné nasdílet ostatním Nextcloud účtům hostovaným na různých instancích a to prostřednictvím jejich identifikátorů v rámci federovaného cloudu.", "Shares that are not part of the internal or external shares. This can be shares from apps or other sources." : "Sdílení, která nejsou součástí interních nebo externích sdílení. Toto mohou být sdílení z aplikací nebo jiných zdrojů.", + "Share with accounts, teams, federated cloud IDs" : "Nasdílejte účtům, týmům, identifikátorům v rámci federovaného cloudu", "Share with accounts and teams" : "Nasdílet účtům a týmům", "Email, federated cloud ID" : "E-mail, identif. federovaného cloudu", "Unable to load the shares list" : "Nedaří se načíst seznam sdílení", diff --git a/apps/files_sharing/l10n/de.js b/apps/files_sharing/l10n/de.js index ce2b7c73e3f..b2fb1dc3159 100644 --- a/apps/files_sharing/l10n/de.js +++ b/apps/files_sharing/l10n/de.js @@ -257,6 +257,7 @@ OC.L10N.register( "File drop" : "Dateiablage", "Upload files to {foldername}." : "Dateien hochladen nach {foldername}.", "By uploading files, you agree to the terms of service." : "Durch das Hochladen von Dateien stimmst du den Nutzungsbedingungen zu.", + "Successfully uploaded files" : "Dateien wurden hochgeladen", "View terms of service" : "Nutzungsbedingungen anzeigen", "Terms of service" : "Nutzungsbedingungen", "Upload files to {folder}" : "Dateien hochladen nach {folder}", diff --git a/apps/files_sharing/l10n/de.json b/apps/files_sharing/l10n/de.json index 0dbe6cc8141..5edc31fe79c 100644 --- a/apps/files_sharing/l10n/de.json +++ b/apps/files_sharing/l10n/de.json @@ -255,6 +255,7 @@ "File drop" : "Dateiablage", "Upload files to {foldername}." : "Dateien hochladen nach {foldername}.", "By uploading files, you agree to the terms of service." : "Durch das Hochladen von Dateien stimmst du den Nutzungsbedingungen zu.", + "Successfully uploaded files" : "Dateien wurden hochgeladen", "View terms of service" : "Nutzungsbedingungen anzeigen", "Terms of service" : "Nutzungsbedingungen", "Upload files to {folder}" : "Dateien hochladen nach {folder}", diff --git a/apps/files_sharing/l10n/de_DE.js b/apps/files_sharing/l10n/de_DE.js index c825e4c948f..69abf34bd75 100644 --- a/apps/files_sharing/l10n/de_DE.js +++ b/apps/files_sharing/l10n/de_DE.js @@ -257,6 +257,7 @@ OC.L10N.register( "File drop" : "Dateiablage", "Upload files to {foldername}." : "Dateien hochladen nach {foldername}.", "By uploading files, you agree to the terms of service." : "Durch das Hochladen von Dateien stimmen Sie den Nutzungsbedingungen zu.", + "Successfully uploaded files" : "Dateien wurden hochgeladen", "View terms of service" : "Nutzungsbedingungen anzeigen", "Terms of service" : "Nutzungsbedingungen", "Upload files to {folder}" : "Dateien hochladen nach {folder}", diff --git a/apps/files_sharing/l10n/de_DE.json b/apps/files_sharing/l10n/de_DE.json index 19c796cfd66..33b5d08bade 100644 --- a/apps/files_sharing/l10n/de_DE.json +++ b/apps/files_sharing/l10n/de_DE.json @@ -255,6 +255,7 @@ "File drop" : "Dateiablage", "Upload files to {foldername}." : "Dateien hochladen nach {foldername}.", "By uploading files, you agree to the terms of service." : "Durch das Hochladen von Dateien stimmen Sie den Nutzungsbedingungen zu.", + "Successfully uploaded files" : "Dateien wurden hochgeladen", "View terms of service" : "Nutzungsbedingungen anzeigen", "Terms of service" : "Nutzungsbedingungen", "Upload files to {folder}" : "Dateien hochladen nach {folder}", diff --git a/apps/files_sharing/l10n/en_GB.js b/apps/files_sharing/l10n/en_GB.js index dc48e5526ee..bfef88bf61a 100644 --- a/apps/files_sharing/l10n/en_GB.js +++ b/apps/files_sharing/l10n/en_GB.js @@ -257,6 +257,7 @@ OC.L10N.register( "File drop" : "File drop", "Upload files to {foldername}." : "Upload files to {foldername}.", "By uploading files, you agree to the terms of service." : "By uploading files, you agree to the terms of service.", + "Successfully uploaded files" : "Successfully uploaded files", "View terms of service" : "View terms of service", "Terms of service" : "Terms of service", "Upload files to {folder}" : "Upload files to {folder}", diff --git a/apps/files_sharing/l10n/en_GB.json b/apps/files_sharing/l10n/en_GB.json index ae93f32a6b2..202aa25d2ad 100644 --- a/apps/files_sharing/l10n/en_GB.json +++ b/apps/files_sharing/l10n/en_GB.json @@ -255,6 +255,7 @@ "File drop" : "File drop", "Upload files to {foldername}." : "Upload files to {foldername}.", "By uploading files, you agree to the terms of service." : "By uploading files, you agree to the terms of service.", + "Successfully uploaded files" : "Successfully uploaded files", "View terms of service" : "View terms of service", "Terms of service" : "Terms of service", "Upload files to {folder}" : "Upload files to {folder}", diff --git a/apps/files_sharing/l10n/fr.js b/apps/files_sharing/l10n/fr.js index 53adc1f132c..f99ebfc1530 100644 --- a/apps/files_sharing/l10n/fr.js +++ b/apps/files_sharing/l10n/fr.js @@ -257,6 +257,7 @@ OC.L10N.register( "File drop" : "Dépôt de fichier", "Upload files to {foldername}." : "Téléverser les fichiers vers {foldername}.", "By uploading files, you agree to the terms of service." : "En téléversant des fichiers, vous acceptez les conditions d'utilisation du service.", + "Successfully uploaded files" : "Fichiers téléversés avec succès", "View terms of service" : "Voir les conditions d'utilisation du service", "Terms of service" : "Conditions d'utilisation", "Upload files to {folder}" : "Téléverser les fichiers dans {folder}", diff --git a/apps/files_sharing/l10n/fr.json b/apps/files_sharing/l10n/fr.json index 58055c96295..ecec9e15f07 100644 --- a/apps/files_sharing/l10n/fr.json +++ b/apps/files_sharing/l10n/fr.json @@ -255,6 +255,7 @@ "File drop" : "Dépôt de fichier", "Upload files to {foldername}." : "Téléverser les fichiers vers {foldername}.", "By uploading files, you agree to the terms of service." : "En téléversant des fichiers, vous acceptez les conditions d'utilisation du service.", + "Successfully uploaded files" : "Fichiers téléversés avec succès", "View terms of service" : "Voir les conditions d'utilisation du service", "Terms of service" : "Conditions d'utilisation", "Upload files to {folder}" : "Téléverser les fichiers dans {folder}", diff --git a/apps/files_sharing/l10n/pt_BR.js b/apps/files_sharing/l10n/pt_BR.js index f75b225aae5..b8c05daa750 100644 --- a/apps/files_sharing/l10n/pt_BR.js +++ b/apps/files_sharing/l10n/pt_BR.js @@ -257,6 +257,7 @@ OC.L10N.register( "File drop" : "Depósito de arquivos", "Upload files to {foldername}." : "Subir arquivos para {foldername}.", "By uploading files, you agree to the terms of service." : "Ao enviar arquivos, você concorda com os termos de serviço.", + "Successfully uploaded files" : "Arquivos carregados com sucesso", "View terms of service" : "Ver os termos de serviço", "Terms of service" : "Termos de serviço", "Upload files to {folder}" : "Enviar arquivos para {folder}", diff --git a/apps/files_sharing/l10n/pt_BR.json b/apps/files_sharing/l10n/pt_BR.json index d1b9e77d278..827e07c452b 100644 --- a/apps/files_sharing/l10n/pt_BR.json +++ b/apps/files_sharing/l10n/pt_BR.json @@ -255,6 +255,7 @@ "File drop" : "Depósito de arquivos", "Upload files to {foldername}." : "Subir arquivos para {foldername}.", "By uploading files, you agree to the terms of service." : "Ao enviar arquivos, você concorda com os termos de serviço.", + "Successfully uploaded files" : "Arquivos carregados com sucesso", "View terms of service" : "Ver os termos de serviço", "Terms of service" : "Termos de serviço", "Upload files to {folder}" : "Enviar arquivos para {folder}", diff --git a/apps/files_sharing/l10n/zh_CN.js b/apps/files_sharing/l10n/zh_CN.js index 404be9f7ab4..5d051eb9950 100644 --- a/apps/files_sharing/l10n/zh_CN.js +++ b/apps/files_sharing/l10n/zh_CN.js @@ -257,6 +257,7 @@ OC.L10N.register( "File drop" : "文件拖放", "Upload files to {foldername}." : "将文件上传到 {foldername}。", "By uploading files, you agree to the terms of service." : "上传文件即表示您同意服务条款。", + "Successfully uploaded files" : "已成功上传文件", "View terms of service" : "查看服务条款", "Terms of service" : "服务条款", "Upload files to {folder}" : "将文件上传到 {folder}", diff --git a/apps/files_sharing/l10n/zh_CN.json b/apps/files_sharing/l10n/zh_CN.json index 2ea3efde3bb..5cd693a66be 100644 --- a/apps/files_sharing/l10n/zh_CN.json +++ b/apps/files_sharing/l10n/zh_CN.json @@ -255,6 +255,7 @@ "File drop" : "文件拖放", "Upload files to {foldername}." : "将文件上传到 {foldername}。", "By uploading files, you agree to the terms of service." : "上传文件即表示您同意服务条款。", + "Successfully uploaded files" : "已成功上传文件", "View terms of service" : "查看服务条款", "Terms of service" : "服务条款", "Upload files to {folder}" : "将文件上传到 {folder}", diff --git a/apps/files_sharing/l10n/zh_HK.js b/apps/files_sharing/l10n/zh_HK.js index dd435890210..b06485d52ae 100644 --- a/apps/files_sharing/l10n/zh_HK.js +++ b/apps/files_sharing/l10n/zh_HK.js @@ -257,6 +257,7 @@ OC.L10N.register( "File drop" : "檔案拖放", "Upload files to {foldername}." : "上傳檔案至 {foldername}。", "By uploading files, you agree to the terms of service." : "上傳檔案即表示您同意服務條款。", + "Successfully uploaded files" : "檔案上傳成功", "View terms of service" : "檢視服務條款", "Terms of service" : "服務條款", "Upload files to {folder}" : "上傳檔案到 {folder}", diff --git a/apps/files_sharing/l10n/zh_HK.json b/apps/files_sharing/l10n/zh_HK.json index 4f6fe38e858..67d1f31894f 100644 --- a/apps/files_sharing/l10n/zh_HK.json +++ b/apps/files_sharing/l10n/zh_HK.json @@ -255,6 +255,7 @@ "File drop" : "檔案拖放", "Upload files to {foldername}." : "上傳檔案至 {foldername}。", "By uploading files, you agree to the terms of service." : "上傳檔案即表示您同意服務條款。", + "Successfully uploaded files" : "檔案上傳成功", "View terms of service" : "檢視服務條款", "Terms of service" : "服務條款", "Upload files to {folder}" : "上傳檔案到 {folder}", diff --git a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php index 686ba32fd49..645250ab2b5 100644 --- a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php +++ b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php @@ -91,6 +91,9 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider 'disclaimer', $this->appConfig->getValueString('core', 'shareapi_public_link_disclaimertext'), ); + // file drops do not request the root folder so we need to provide label and note if available + $this->initialState->provideInitialState('label', $share->getLabel()); + $this->initialState->provideInitialState('note', $share->getNote()); } // Set up initial state $this->initialState->provideInitialState('isPublic', true); @@ -149,10 +152,7 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider $headerActions = []; if ($view !== 'public-file-drop' && !$share->getHideDownload()) { // The download URL is used for the "download" header action as well as in some cases for the direct link - $downloadUrl = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', [ - 'token' => $token, - 'filename' => ($shareNode instanceof File) ? $shareNode->getName() : null, - ]); + $downloadUrl = $this->urlGenerator->getAbsoluteURL('/public.php/dav/files/' . $token . '/?accept=zip'); // If not a file drop, then add the download header action $headerActions[] = new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download', $downloadUrl, 0, (string)$shareNode->getSize()); diff --git a/apps/files_sharing/src/files_views/publicFileDrop.ts b/apps/files_sharing/src/files_views/publicFileDrop.ts index 0d782d48fc7..65756e83c74 100644 --- a/apps/files_sharing/src/files_views/publicFileDrop.ts +++ b/apps/files_sharing/src/files_views/publicFileDrop.ts @@ -4,7 +4,8 @@ */ import type { VueConstructor } from 'vue' -import { Folder, Permission, View, davRemoteURL, davRootPath, getNavigation } from '@nextcloud/files' +import { Folder, Permission, View, getNavigation } from '@nextcloud/files' +import { defaultRemoteURL, defaultRootPath } from '@nextcloud/files/dav' import { loadState } from '@nextcloud/initial-state' import { translate as t } from '@nextcloud/l10n' import svgCloudUpload from '@mdi/svg/svg/cloud-upload.svg?raw' @@ -45,8 +46,8 @@ export default () => { // Fake a writeonly folder as root folder: new Folder({ id: 0, - source: `${davRemoteURL}${davRootPath}`, - root: davRootPath, + source: `${defaultRemoteURL}${defaultRootPath}`, + root: defaultRootPath, owner: null, permissions: Permission.CREATE, }), diff --git a/apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue b/apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue index 5571e5e9f5d..33fec9af028 100644 --- a/apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue +++ b/apps/files_sharing/src/views/FilesViewFileDropEmptyContent.vue @@ -5,13 +5,29 @@ <template> <NcEmptyContent class="file-drop-empty-content" data-cy-files-sharing-file-drop - :name="t('files_sharing', 'File drop')"> + :name="name"> <template #icon> <NcIconSvgWrapper :svg="svgCloudUpload" /> </template> <template #description> - {{ t('files_sharing', 'Upload files to {foldername}.', { foldername }) }} - {{ disclaimer === '' ? '' : t('files_sharing', 'By uploading files, you agree to the terms of service.') }} + <p> + {{ shareNote || t('files_sharing', 'Upload files to {foldername}.', { foldername }) }} + </p> + <p v-if="disclaimer"> + {{ t('files_sharing', 'By uploading files, you agree to the terms of service.') }} + </p> + <NcNoteCard v-if="getSortedUploads().length" + class="file-drop-empty-content__note-card" + type="success"> + <h2 id="file-drop-empty-content__heading"> + {{ t('files_sharing', 'Successfully uploaded files') }} + </h2> + <ul aria-labelledby="file-drop-empty-content__heading" class="file-drop-empty-content__list"> + <li v-for="file in getSortedUploads()" :key="file"> + {{ file }} + </li> + </ul> + </NcNoteCard> </template> <template #action> <template v-if="disclaimer"> @@ -34,16 +50,24 @@ </NcEmptyContent> </template> +<script lang="ts"> +/* eslint-disable import/first */ + +// We need this on module level rather than on the instance as view will be refreshed by the files app after uploading +const uploads = new Set<string>() +</script> + <script setup lang="ts"> import { loadState } from '@nextcloud/initial-state' import { translate as t } from '@nextcloud/l10n' -import { getUploader, UploadPicker } from '@nextcloud/upload' +import { getUploader, UploadPicker, UploadStatus } from '@nextcloud/upload' import { ref } from 'vue' import NcButton from '@nextcloud/vue/components/NcButton' import NcDialog from '@nextcloud/vue/components/NcDialog' import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent' import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper' +import NcNoteCard from '@nextcloud/vue/components/NcNoteCard' import svgCloudUpload from '@mdi/svg/svg/cloud-upload.svg?raw' defineProps<{ @@ -51,17 +75,62 @@ defineProps<{ }>() const disclaimer = loadState<string>('files_sharing', 'disclaimer', '') +const shareLabel = loadState<string>('files_sharing', 'label', '') +const shareNote = loadState<string>('files_sharing', 'note', '') + +const name = shareLabel || t('files_sharing', 'File drop') + const showDialog = ref(false) const uploadDestination = getUploader().destination -</script> -<style scoped> -:deep(.terms-of-service-dialog) { - min-height: min(100px, 20vh); +getUploader() + .addNotifier((upload) => { + if (upload.status === UploadStatus.FINISHED && upload.file.name) { + // if a upload is finished and is not a meta upload (name is set) + // then we add the upload to the list of finished uploads to be shown to the user + uploads.add(upload.file.name) + } + }) + +/** + * Get the previous uploads as sorted list + */ +function getSortedUploads() { + return [...uploads].sort((a, b) => a.localeCompare(b)) } -/* TODO fix in library */ -.file-drop-empty-content :deep(.empty-content__action) { - display: flex; - gap: var(--default-grid-baseline); +</script> + +<style scoped lang="scss"> +.file-drop-empty-content { + margin: auto; + max-width: max(50vw, 300px); + + .file-drop-empty-content__note-card { + width: fit-content; + margin-inline: auto; + } + + #file-drop-empty-content__heading { + margin-block: 0 10px; + font-weight: bold; + font-size: 20px; + } + + .file-drop-empty-content__list { + list-style: inside; + max-height: min(350px, 33vh); + overflow-y: scroll; + padding-inline-end: calc(2 * var(--default-grid-baseline)); + } + + :deep(.terms-of-service-dialog) { + min-height: min(100px, 20vh); + } + + /* TODO fix in library */ + :deep(.empty-content__action) { + display: flex; + gap: var(--default-grid-baseline); + } } </style> diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 58cbb4e0b82..a6bef1bed56 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -261,8 +261,12 @@ class ShareControllerTest extends \Test\TestCase { ['files_sharing.sharecontroller.showShare', ['token' => 'token'], 'shareUrl'], // this share is not an image to the default preview is used ['files_sharing.PublicPreview.getPreview', ['x' => 256, 'y' => 256, 'file' => $share->getTarget(), 'token' => 'token'], 'previewUrl'], - // for the direct link - ['files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename ], 'downloadUrl'], + ]); + + $this->urlGenerator->expects($this->once()) + ->method('getAbsoluteURL') + ->willReturnMap([ + ['/public.php/dav/files/token/?accept=zip', 'downloadUrl'], ]); $this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true); @@ -395,6 +399,8 @@ class ShareControllerTest extends \Test\TestCase { ->setPassword('password') ->setShareOwner('ownerUID') ->setSharedBy('initiatorUID') + ->setNote('The note') + ->setLabel('A label') ->setNode($file) ->setTarget("/$filename") ->setToken('token'); @@ -474,6 +480,8 @@ class ShareControllerTest extends \Test\TestCase { 'disclaimer' => 'My disclaimer text', 'owner' => 'ownerUID', 'ownerDisplayName' => 'ownerDisplay', + 'note' => 'The note', + 'label' => 'A label', ]; $response = $this->shareController->showShare(); @@ -483,9 +491,9 @@ class ShareControllerTest extends \Test\TestCase { $csp = new ContentSecurityPolicy(); $csp->addAllowedFrameDomain('\'self\''); $expectedResponse = new PublicTemplateResponse('files', 'index'); - $expectedResponse->setParams(['pageTitle' => $filename]); + $expectedResponse->setParams(['pageTitle' => 'A label']); $expectedResponse->setContentSecurityPolicy($csp); - $expectedResponse->setHeaderTitle($filename); + $expectedResponse->setHeaderTitle('A label'); $expectedResponse->setHeaderDetails('shared by ownerDisplay'); $expectedResponse->setHeaderActions([ new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', 'shareUrl'), @@ -552,8 +560,12 @@ class ShareControllerTest extends \Test\TestCase { ['files_sharing.sharecontroller.showShare', ['token' => 'token'], 'shareUrl'], // this share is not an image to the default preview is used ['files_sharing.PublicPreview.getPreview', ['x' => 256, 'y' => 256, 'file' => $share->getTarget(), 'token' => 'token'], 'previewUrl'], - // for the direct link - ['files_sharing.sharecontroller.downloadShare', ['token' => 'token', 'filename' => $filename ], 'downloadUrl'], + ]); + + $this->urlGenerator->expects($this->once()) + ->method('getAbsoluteURL') + ->willReturnMap([ + ['/public.php/dav/files/token/?accept=zip', 'downloadUrl'], ]); $this->previewManager->method('isMimeSupported')->with('text/plain')->willReturn(true); |