Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions l10n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ msgstr ""
msgid "Upload some content or sync with your devices!"
msgstr ""

msgid "You are currently identified as {nickname}."
msgstr ""

msgid "You are currently not identified."
msgstr ""

Expand Down
18 changes: 16 additions & 2 deletions lib/components/PublicAuthPrompt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface PublicAuthPromptProps {

const props = withDefaults(defineProps<PublicAuthPromptProps>(), {
nickname: '',
notice: t('You are currently not identified.'),
notice: '',
submitLabel: t('Submit name'),
text: '',
title: t('Guest identification'),
Expand Down Expand Up @@ -104,6 +104,20 @@ const buttons = computed(() => {
return [submitButton]
})

const defaultNotice = computed(() => {
if (props.notice) {
return props.notice
}

// If no notice is provided, use a default one
// that changes based on the nickname definition
if (name.value) {
return t('You are currently identified as {nickname}.', { nickname: name.value })
}

return t('You are currently not identified.')
})

/**
* Handle saving the nickname and return it.
*/
Expand Down Expand Up @@ -169,7 +183,7 @@ function onSubmit() {
<!-- Header -->
<NcNoteCard
class="public-auth-prompt__header"
:text="notice"
:text="defaultNotice"
type="info" />

<!-- Form -->
Expand Down