Skip to content

Commit

Permalink
Merge pull request #804 from nextcloud/fix/anonymous_text
Browse files Browse the repository at this point in the history
Fix anonymous text
  • Loading branch information
jotoeri authored Mar 8, 2021
2 parents f21bb63 + 8053917 commit b5545c9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion src/FormsSubmit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<Content app-name="forms">
<Submit
:form="form"
:public-view="true" />
:public-view="true"
:is-logged-in="isLoggedIn" />
</Content>
</template>

Expand All @@ -44,6 +45,7 @@ export default {
data() {
return {
form: loadState('forms', 'form'),
isLoggedIn: loadState('forms', 'isLoggedIn'),
}
},
}
Expand Down
7 changes: 6 additions & 1 deletion src/views/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
Expand Down
12 changes: 11 additions & 1 deletion src/views/Submit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ export default {

mixins: [ViewsMixin],

props: {
isLoggedIn: {
type: Boolean,
required: false,
default: true,
},
},

data() {
return {
maxStringLengths: loadState('forms', 'maxStringLengths'),
Expand Down Expand Up @@ -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
},
},
Expand Down

0 comments on commit b5545c9

Please sign in to comment.