From 8053917cf7e05220f80c60f0d76e98064f9c572f Mon Sep 17 00:00:00 2001 From: Jonas Rittershofer Date: Wed, 24 Feb 2021 23:58:20 +0100 Subject: [PATCH] Fix anonyomous text Signed-off-by: Jonas Rittershofer --- lib/Controller/PageController.php | 1 + src/FormsSubmit.vue | 4 +++- src/views/Create.vue | 7 ++++++- src/views/Submit.vue | 12 +++++++++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index dc7d811b9..d744c89b5 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -178,6 +178,7 @@ public function gotoForm(string $hash): Response { // Main Template to fill the form Util::addScript($this->appName, 'forms-submit'); $this->initialStateService->provideInitialState($this->appName, 'form', $this->formsService->getPublicForm($form->getId())); + $this->initialStateService->provideInitialState($this->appName, 'isLoggedIn', $this->userSession->isLoggedIn()); $this->initialStateService->provideInitialState($this->appName, 'maxStringLengths', $this->maxStringLengths); return $this->provideTemplate(self::TEMPLATE_MAIN, $form); } diff --git a/src/FormsSubmit.vue b/src/FormsSubmit.vue index 0f8fad424..6d0fda694 100644 --- a/src/FormsSubmit.vue +++ b/src/FormsSubmit.vue @@ -24,7 +24,8 @@ + :public-view="true" + :is-logged-in="isLoggedIn" /> @@ -44,6 +45,7 @@ export default { data() { return { form: loadState('forms', 'form'), + isLoggedIn: loadState('forms', 'isLoggedIn'), } }, } diff --git a/src/views/Create.vue b/src/views/Create.vue index cb356f0b7..f15481afd 100644 --- a/src/views/Create.vue +++ b/src/views/Create.vue @@ -212,12 +212,17 @@ export default { let message = '' if (this.form.isAnonymous) { message += t('forms', 'Responses are anonymous.') - } else { + } + + // On Submit, this is dependent on `isLoggedIn`. Create-view is always logged in and the variable isLoggedIn does not exist. + if (!this.form.isAnonymous && true) { message += t('forms', 'Responses are connected to your Nextcloud account.') } + if (this.isMandatoryUsed) { message += ' ' + t('forms', 'An asterisk (*) indicates mandatory questions.') } + return message }, }, diff --git a/src/views/Submit.vue b/src/views/Submit.vue index ad5a86ceb..c5a4f4fa4 100644 --- a/src/views/Submit.vue +++ b/src/views/Submit.vue @@ -107,6 +107,14 @@ export default { mixins: [ViewsMixin], + props: { + isLoggedIn: { + type: Boolean, + required: false, + default: true, + }, + }, + data() { return { maxStringLengths: loadState('forms', 'maxStringLengths'), @@ -152,12 +160,14 @@ export default { let message = '' if (this.form.isAnonymous) { message += t('forms', 'Responses are anonymous.') - } else { + } + if (!this.form.isAnonymous && this.isLoggedIn) { message += t('forms', 'Responses are connected to your Nextcloud account.') } if (this.isMandatoryUsed) { message += ' ' + t('forms', 'An asterisk (*) indicates mandatory questions.') } + return message }, },