diff --git a/lib/Constants.php b/lib/Constants.php index 44ce72a1d..937700618 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -68,16 +68,13 @@ class Constants { public const FORM_ACCESS_NOPUBLICSHARE = 0; public const FORM_ACCESS_PERMITALLUSERS = 1; public const FORM_ACCESS_SHOWTOALLUSERS = 2; + /** @deprecated 5.0.0 still needed for Migrations */ public const FORM_ACCESS_LEGACYLINK = 3; - public const FORM_ACCESS_LEGACYLINK_PERMITALLUSERS = 4; - public const FORM_ACCESS_LEGACYLINK_SHOWTOALLUSERS = 5; public const FORM_ACCESS_ARRAY_PERMIT = [ self::FORM_ACCESS_PERMITALLUSERS, - self::FORM_ACCESS_LEGACYLINK_PERMITALLUSERS ]; public const FORM_ACCESS_ARRAY_SHOWN = [ self::FORM_ACCESS_SHOWTOALLUSERS, - self::FORM_ACCESS_LEGACYLINK_SHOWTOALLUSERS ]; /** diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index f3b0584a6..d695213d4 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -2765,11 +2765,6 @@ private function loadFormForSubmission(int $formId, string $shareHash): Form { // If hash given, find the corresponding share & check if hash corresponds to given formId. if ($shareHash !== '') { - // public by legacy Link - if (isset($form->getAccess()['legacyLink']) && $shareHash === $form->getHash()) { - $isPublicShare = true; - } - // Public link share $share = $this->shareMapper->findPublicShareByHash($shareHash); if ($share->getFormId() === $formId) { diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 75e431b15..e3b72fc12 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -117,31 +117,6 @@ public function internalLinkView(string $hash): Response { return new RedirectResponse($internalView); } - // For legacy-support, show public template - try { - $form = $this->formMapper->findByHash($hash); - } catch (DoesNotExistException $e) { - return $this->provideEmptyContent(Constants::EMPTY_NOTFOUND); - } - if (isset($form->getAccess()['legacyLink'])) { - // Inject style on all templates - Util::addStyle($this->appName, 'forms'); - - // Has form expired - if ($this->formsService->hasFormExpired($form)) { - return $this->provideEmptyContent(Constants::EMPTY_EXPIRED, $form); - } - - // Public Template to fill the form - Util::addScript($this->appName, 'forms-submit'); - $this->insertHeaderOnIos(); - $this->initialState->provideInitialState('form', $this->formsService->getPublicForm($form)); - $this->initialState->provideInitialState('isLoggedIn', $this->userSession->isLoggedIn()); - $this->initialState->provideInitialState('shareHash', $hash); - $this->initialState->provideInitialState('maxStringLengths', Constants::MAX_STRING_LENGTHS); - return $this->provideTemplate(self::TEMPLATE_MAIN, $form); - } - // Otherwise Redirect to login (& then internal view) return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', ['redirect_url' => $internalView])); } diff --git a/lib/Db/Form.php b/lib/Db/Form.php index c2c4144de..d08665b98 100644 --- a/lib/Db/Form.php +++ b/lib/Db/Form.php @@ -98,10 +98,7 @@ public function getAccess(): array { $accessEnum = $this->getAccessEnum(); $access = []; - if ($accessEnum >= Constants::FORM_ACCESS_LEGACYLINK) { - $access['legacyLink'] = true; - } - switch ($accessEnum % Constants::FORM_ACCESS_LEGACYLINK) { + switch ($accessEnum) { case Constants::FORM_ACCESS_NOPUBLICSHARE: $access['permitAllUsers'] = false; $access['showToAllUsers'] = false; @@ -135,11 +132,6 @@ public function setAccess(array $access) { $value = Constants::FORM_ACCESS_PERMITALLUSERS; } - // If legacyLink add 3 - if (isset($access['legacyLink']) && $access['legacyLink']) { - $value += Constants::FORM_ACCESS_LEGACYLINK; - } - $this->setAccessEnum($value); } diff --git a/lib/Migration/Version050000Date20241005173955.php b/lib/Migration/Version050000Date20241005173955.php new file mode 100644 index 000000000..d93ee3ead --- /dev/null +++ b/lib/Migration/Version050000Date20241005173955.php @@ -0,0 +1,38 @@ +db->getQueryBuilder(); + + $qbUpdate->update('forms_v2_forms') + ->set('access_enum', 'access_enum - 3') + ->where($qbUpdate->expr()->gte('access_enum', '3')) + ->executeStatement(); + } +} diff --git a/lib/Service/FormsService.php b/lib/Service/FormsService.php index 386a4f727..540d545da 100644 --- a/lib/Service/FormsService.php +++ b/lib/Service/FormsService.php @@ -357,7 +357,7 @@ public function canDeleteResults(Form $form): bool { * @return boolean */ public function canSubmit(Form $form): bool { - // We cannot control how many time users can submit if public link / legacyLink available + // We cannot control how many time users can submit if public link available if ($this->hasPublicLink($form)) { return true; } @@ -387,10 +387,6 @@ public function canSubmit(Form $form): bool { private function hasPublicLink(Form $form): bool { $access = $form->getAccess(); - if (isset($access['legacyLink'])) { - return true; - } - $shareEntities = $this->shareMapper->findByForm($form->getId()); foreach ($shareEntities as $shareEntity) { if ($shareEntity->getShareType() === IShare::TYPE_LINK) { diff --git a/src/components/SidebarTabs/SettingsSidebarTab.vue b/src/components/SidebarTabs/SettingsSidebarTab.vue index eb5d657fc..16bfd891c 100644 --- a/src/components/SidebarTabs/SettingsSidebarTab.vue +++ b/src/components/SidebarTabs/SettingsSidebarTab.vue @@ -208,11 +208,7 @@ export default { * Submit Multiple is disabled, if it cannot be controlled. */ disableSubmitMultiple() { - return ( - this.hasPublicLink || - this.form.access.legacyLink || - this.form.isAnonymous - ) + return this.hasPublicLink || this.form.isAnonymous }, disableSubmitMultipleExplanation() { if (this.disableSubmitMultiple) { diff --git a/src/components/SidebarTabs/SharingSidebarTab.vue b/src/components/SidebarTabs/SharingSidebarTab.vue index 308c41b84..fc8138805 100644 --- a/src/components/SidebarTabs/SharingSidebarTab.vue +++ b/src/components/SidebarTabs/SharingSidebarTab.vue @@ -115,37 +115,6 @@ :text="qrDialogText" @closed="qrDialogText = ''" /> - -
-
- -
-
- {{ t('forms', 'Legacy Link') }} - {{ - t('forms', 'Form still supports old sharing-link.') - }} -
-
- -
- - - - {{ t('forms', 'Remove Legacy Link') }} - - -
-
@@ -229,7 +198,6 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js' import NcActionLink from '@nextcloud/vue/dist/Components/NcActionLink.js' import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js' import IconAccountMultiple from 'vue-material-design-icons/AccountMultiple.vue' -import IconAlertCircleOutline from 'vue-material-design-icons/AlertCircleOutline.vue' import IconCodeBrackets from 'vue-material-design-icons/CodeBrackets.vue' import IconDelete from 'vue-material-design-icons/Delete.vue' import IconLinkBoxVariantOutline from 'vue-material-design-icons/LinkBoxVariantOutline.vue' @@ -252,7 +220,6 @@ export default { components: { FormsIcon, IconAccountMultiple, - IconAlertCircleOutline, IconCodeBrackets, IconCopyAll, IconDelete, @@ -469,11 +436,6 @@ export default { newAccess.showToAllUsers = newVal this.$emit('update:formProp', 'access', newAccess) }, - removeLegacyLink() { - const newAccess = { ...this.form.access } - delete newAccess.legacyLink - this.$emit('update:formProp', 'access', newAccess) - }, openQrDialog(share) { this.qrDialogText = this.getPublicShareLink(share) @@ -535,11 +497,5 @@ export default { } } } - - &__legacy-warning { - background-size: 18px; - margin-inline-end: 4px; - color: var(--color-error); - } } diff --git a/src/views/Create.vue b/src/views/Create.vue index 63efa343f..e8d4a97a8 100644 --- a/src/views/Create.vue +++ b/src/views/Create.vue @@ -104,19 +104,6 @@

{{ infoMessage }}

- - - {{ - t( - 'forms', - 'This form still uses a deprecated share link, that will be removed in Forms 5.0. Please use the new sharing mechanism.', - ) - }} -
diff --git a/src/views/Submit.vue b/src/views/Submit.vue index 7102ad7ae..3bd91bd0f 100644 --- a/src/views/Submit.vue +++ b/src/views/Submit.vue @@ -63,19 +63,6 @@

{{ infoMessage }}

- - - {{ - t( - 'forms', - 'This form still uses a deprecated share link, that will be removed in Forms 5.0. Please use the new sharing mechanism.', - ) - }} -