Merge pull request #4771 from nextcloud/enh/noid/listable-wording

Updated wording for conversation visibility
This commit is contained in:
Joas Schilling 2021-01-18 10:15:38 +01:00 коммит произвёл GitHub
Родитель 2c6f9eb73e bd27c5adf1
Коммит ede363b85e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 86 добавлений и 54 удалений

Просмотреть файл

@ -161,9 +161,9 @@ Base endpoint is: `/ocs/v2.php/apps/spreed/api/v1`
* `call_ended` - Call with {user1}, {user2}, {user3}, {user4} and {user5} (Duration 30:23)
* `read_only_off` - {actor} unlocked the conversation
* `read_only` - {actor} locked the conversation
* `listable_none` - {actor} made the conversation visible for nobody
* `listable_users` - {actor} made the conversation visible for regular users
* `listable_all` - {actor} made the conversation visible for everone which includes users and guests
* `listable_none` - {actor} limited the conversation to the current participants
* `listable_users` - {actor} opened the conversation accessible to registered users
* `listable_all` - {actor} opened the conversation accessible to registered and guest app users
* `lobby_timer_reached` - The conversation is now open to everyone
* `lobby_none` - {actor} opened the conversation to everyone
* `lobby_non_moderators` - {actor} restricted the conversation to moderators

Просмотреть файл

@ -166,25 +166,25 @@ class SystemMessage {
$parsedMessage = $this->l->t('An administrator locked the conversation');
}
} elseif ($message === 'listable_none') {
$parsedMessage = $this->l->t('{actor} made the conversation invisible');
$parsedMessage = $this->l->t('{actor} limited the conversation to the current participants');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You made the conversation invisible');
$parsedMessage = $this->l->t('You limited the conversation to the current participants');
} elseif ($cliIsActor) {
$parsedMessage = $this->l->t('An administrator made the conversation invisible');
$parsedMessage = $this->l->t('An administrator limited the conversation to the current participants');
}
} elseif ($message === 'listable_users') {
$parsedMessage = $this->l->t('{actor} made the conversation visible for registered users only');
$parsedMessage = $this->l->t('{actor} opened the conversation to registered users');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You made the conversation visible for registered users only');
$parsedMessage = $this->l->t('You opened the conversation to registered users');
} elseif ($cliIsActor) {
$parsedMessage = $this->l->t('An administrator made the visible for registered users only');
$parsedMessage = $this->l->t('An administrator opened the conversation to registered users');
}
} elseif ($message === 'listable_all') {
$parsedMessage = $this->l->t('{actor} made the conversation visible for everyone');
$parsedMessage = $this->l->t('{actor} opened the conversation to registered and guest app users');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You made the conversation visible for everyone');
$parsedMessage = $this->l->t('You opened the conversation to registered and guest app users');
} elseif ($cliIsActor) {
$parsedMessage = $this->l->t('An administrator made the conversation visible for everyone');
$parsedMessage = $this->l->t('An administrator opened the conversation to registered and guest app users');
}
} elseif ($message === 'lobby_timer_reached') {
$parsedMessage = $this->l->t('The conversation is now open to everyone');

Просмотреть файл

@ -87,6 +87,11 @@ trait TInitialState {
$appManager->isEnabledForUser('circles', $user)
);
$this->initialStateService->provideInitialState(
'talk', 'guests_accounts_enabled',
$appManager->isEnabledForUser('guests', $user)
);
$this->initialStateService->provideInitialState(
'talk', 'read_status_privacy',
$this->talkConfig->getUserReadPrivacy($user->getUID())

Просмотреть файл

@ -21,42 +21,43 @@
<template>
<div class="app-settings-subsection">
<div id="moderation_settings_listable_conversation_hint" class="app-settings-section__hint">
{{ t('spreed', 'Defines who can find this conversation without being invited') }}
</div>
<div>
<Multiselect
v-model="listable"
class="listable-options-select"
:options="listableOptions"
:placeholder="t('spreed', 'Visible for')"
label="label"
track-by="value"
<input id="listable_settings_registered_users_checkbox"
aria-describedby="listable_settings_listable_conversation_hint"
type="checkbox"
class="checkbox"
name="listable_settings_registered_users_checkbox"
:checked="listable !== LISTABLE.NONE"
:disabled="isListableLoading"
aria-describedby="moderation_settings_listable_conversation_hint"
@input="saveListable" />
@change="toggleListableUsers">
<label for="listable_settings_registered_users_checkbox">{{ t('spreed', 'Open conversation to registered users') }}</label>
</div>
<div v-if="listable !== LISTABLE.NONE" class="indent">
<div id="moderation_settings_listable_conversation_hint" class="app-settings-section__hint">
{{ t('spreed', 'This conversation will be shown in search results') }}
</div>
<div v-if="listable !== LISTABLE.NONE && isGuestsAccountsEnabled">
<input id="listable_settings_guestapp_users_checkbox"
type="checkbox"
class="checkbox"
name="listable_settings_guestapp_users_checkbox"
:checked="listable === LISTABLE.ALL"
:disabled="isListableLoading"
@change="toggleListableGuests">
<label for="listable_settings_guestapp_users_checkbox">{{ t('spreed', 'Also open to guest app users') }}</label>
</div>
</div>
</div>
</template>
<script>
import Multiselect from '@nextcloud/vue/dist/Components/Multiselect'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { CONVERSATION } from '../../constants'
const listableOptions = [
{ value: CONVERSATION.LISTABLE.NONE, label: t('spreed', 'Visible for no one') },
{ value: CONVERSATION.LISTABLE.USERS, label: t('spreed', 'Visible for registered users only') },
{ value: CONVERSATION.LISTABLE.ALL, label: t('spreed', 'Visible for everyone') },
]
import { loadState } from '@nextcloud/initial-state'
export default {
name: 'ListableSettings',
components: {
Multiselect,
},
props: {
token: {
type: String,
@ -71,9 +72,11 @@ export default {
data() {
return {
isListableLoading: false,
listableOptions,
listable: null,
isListableLoading: false,
lastNotification: null,
isGuestsAccountsEnabled: loadState('talk', 'guests_accounts_enabled'),
LISTABLE: CONVERSATION.LISTABLE,
}
},
@ -97,30 +100,50 @@ export default {
}
},
beforeDestroy() {
if (this.lastNotification) {
this.lastNotification.hideToast()
this.lastNotification = null
}
},
methods: {
async toggleListableUsers(event) {
await this.saveListable(event.target.checked ? this.LISTABLE.USERS : this.LISTABLE.NONE)
},
async toggleListableGuests(input) {
await this.saveListable(event.target.checked ? this.LISTABLE.ALL : this.LISTABLE.USERS)
},
async saveListable(listable) {
this.$emit('input', listable.value)
this.$emit('input', listable)
if (!this.token) {
this.listable = listable.value
this.listable = listable
return
}
this.isListableLoading = true
try {
await this.$store.dispatch('setListable', {
token: this.token,
listable: listable.value,
listable: listable,
})
if (listable.value === CONVERSATION.LISTABLE.NONE) {
showSuccess(t('spreed', 'You made the conversation invisible'))
} else if (listable.value === CONVERSATION.LISTABLE.USERS) {
showSuccess(t('spreed', 'You made the conversation visible for registered users only'))
} else if (listable.value === CONVERSATION.LISTABLE.ALL) {
showSuccess(t('spreed', 'You made the conversation visible for everyone'))
if (this.lastNotification) {
this.lastNotification.hideToast()
this.lastNotification = null
}
if (listable === CONVERSATION.LISTABLE.NONE) {
this.lastNotification = showSuccess(t('spreed', 'You limited the conversation to the current participants'))
} else if (listable === CONVERSATION.LISTABLE.USERS) {
this.lastNotification = showSuccess(t('spreed', 'You opened the conversation to registered users'))
} else if (listable === CONVERSATION.LISTABLE.ALL) {
this.lastNotification = showSuccess(t('spreed', 'You opened the conversation to registered and guest app users'))
}
this.listable = listable
} catch (e) {
console.error('Error occurred when updating the conversation visibility', e)
showError(t('spreed', 'Error occurred when updating the conversation visibility'))
console.error('Error occurred when opening or limiting the conversation', e)
showError(t('spreed', 'Error occurred when opening or limiting the conversation'))
this.listable = this.conversation.listable
}
this.isListableLoading = false
@ -133,4 +156,8 @@ export default {
.listable-options-select {
width: 100%;
}
.indent {
margin-left: 26px;
}
</style>

Просмотреть файл

@ -332,27 +332,27 @@ class SystemMessageTest extends TestCase {
['actor' => ['id' => 'actor', 'type' => 'user']],
],
['listable_none', [], 'recipient',
'{actor} made the conversation invisible',
'{actor} limited the conversation to the current participants',
['actor' => ['id' => 'actor', 'type' => 'user']],
],
['listable_none', [], 'actor',
'You made the conversation invisible',
'You limited the conversation to the current participants',
['actor' => ['id' => 'actor', 'type' => 'user']],
],
['listable_users', [], 'recipient',
'{actor} made the conversation visible for registered users only',
'{actor} opened the conversation to registered users',
['actor' => ['id' => 'actor', 'type' => 'user']],
],
['listable_users', [], 'actor',
'You made the conversation visible for registered users only',
'You opened the conversation to registered users',
['actor' => ['id' => 'actor', 'type' => 'user']],
],
['listable_all', [], 'recipient',
'{actor} made the conversation visible for everyone',
'{actor} opened the conversation to registered and guest app users',
['actor' => ['id' => 'actor', 'type' => 'user']],
],
['listable_all', [], 'actor',
'You made the conversation visible for everyone',
'You opened the conversation to registered and guest app users',
['actor' => ['id' => 'actor', 'type' => 'user']],
],
];