зеркало из https://github.com/nextcloud/spreed.git
Merge pull request #4771 from nextcloud/enh/noid/listable-wording
Updated wording for conversation visibility
This commit is contained in:
Коммит
ede363b85e
|
@ -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)
|
* `call_ended` - Call with {user1}, {user2}, {user3}, {user4} and {user5} (Duration 30:23)
|
||||||
* `read_only_off` - {actor} unlocked the conversation
|
* `read_only_off` - {actor} unlocked the conversation
|
||||||
* `read_only` - {actor} locked the conversation
|
* `read_only` - {actor} locked the conversation
|
||||||
* `listable_none` - {actor} made the conversation visible for nobody
|
* `listable_none` - {actor} limited the conversation to the current participants
|
||||||
* `listable_users` - {actor} made the conversation visible for regular users
|
* `listable_users` - {actor} opened the conversation accessible to registered users
|
||||||
* `listable_all` - {actor} made the conversation visible for everone which includes users and guests
|
* `listable_all` - {actor} opened the conversation accessible to registered and guest app users
|
||||||
* `lobby_timer_reached` - The conversation is now open to everyone
|
* `lobby_timer_reached` - The conversation is now open to everyone
|
||||||
* `lobby_none` - {actor} opened the conversation to everyone
|
* `lobby_none` - {actor} opened the conversation to everyone
|
||||||
* `lobby_non_moderators` - {actor} restricted the conversation to moderators
|
* `lobby_non_moderators` - {actor} restricted the conversation to moderators
|
||||||
|
|
|
@ -166,25 +166,25 @@ class SystemMessage {
|
||||||
$parsedMessage = $this->l->t('An administrator locked the conversation');
|
$parsedMessage = $this->l->t('An administrator locked the conversation');
|
||||||
}
|
}
|
||||||
} elseif ($message === 'listable_none') {
|
} 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) {
|
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) {
|
} 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') {
|
} 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) {
|
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) {
|
} 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') {
|
} 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) {
|
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) {
|
} 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') {
|
} elseif ($message === 'lobby_timer_reached') {
|
||||||
$parsedMessage = $this->l->t('The conversation is now open to everyone');
|
$parsedMessage = $this->l->t('The conversation is now open to everyone');
|
||||||
|
|
|
@ -87,6 +87,11 @@ trait TInitialState {
|
||||||
$appManager->isEnabledForUser('circles', $user)
|
$appManager->isEnabledForUser('circles', $user)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->initialStateService->provideInitialState(
|
||||||
|
'talk', 'guests_accounts_enabled',
|
||||||
|
$appManager->isEnabledForUser('guests', $user)
|
||||||
|
);
|
||||||
|
|
||||||
$this->initialStateService->provideInitialState(
|
$this->initialStateService->provideInitialState(
|
||||||
'talk', 'read_status_privacy',
|
'talk', 'read_status_privacy',
|
||||||
$this->talkConfig->getUserReadPrivacy($user->getUID())
|
$this->talkConfig->getUserReadPrivacy($user->getUID())
|
||||||
|
|
|
@ -21,42 +21,43 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="app-settings-subsection">
|
<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>
|
<div>
|
||||||
<Multiselect
|
<input id="listable_settings_registered_users_checkbox"
|
||||||
v-model="listable"
|
aria-describedby="listable_settings_listable_conversation_hint"
|
||||||
class="listable-options-select"
|
type="checkbox"
|
||||||
:options="listableOptions"
|
class="checkbox"
|
||||||
:placeholder="t('spreed', 'Visible for')"
|
name="listable_settings_registered_users_checkbox"
|
||||||
label="label"
|
:checked="listable !== LISTABLE.NONE"
|
||||||
track-by="value"
|
|
||||||
:disabled="isListableLoading"
|
:disabled="isListableLoading"
|
||||||
aria-describedby="moderation_settings_listable_conversation_hint"
|
@change="toggleListableUsers">
|
||||||
@input="saveListable" />
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Multiselect from '@nextcloud/vue/dist/Components/Multiselect'
|
|
||||||
import { showError, showSuccess } from '@nextcloud/dialogs'
|
import { showError, showSuccess } from '@nextcloud/dialogs'
|
||||||
import { CONVERSATION } from '../../constants'
|
import { CONVERSATION } from '../../constants'
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
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') },
|
|
||||||
]
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ListableSettings',
|
name: 'ListableSettings',
|
||||||
|
|
||||||
components: {
|
|
||||||
Multiselect,
|
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
token: {
|
token: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -71,9 +72,11 @@ export default {
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isListableLoading: false,
|
|
||||||
listableOptions,
|
|
||||||
listable: null,
|
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: {
|
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) {
|
async saveListable(listable) {
|
||||||
this.$emit('input', listable.value)
|
this.$emit('input', listable)
|
||||||
if (!this.token) {
|
if (!this.token) {
|
||||||
this.listable = listable.value
|
this.listable = listable
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.isListableLoading = true
|
this.isListableLoading = true
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('setListable', {
|
await this.$store.dispatch('setListable', {
|
||||||
token: this.token,
|
token: this.token,
|
||||||
listable: listable.value,
|
listable: listable,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (listable.value === CONVERSATION.LISTABLE.NONE) {
|
if (this.lastNotification) {
|
||||||
showSuccess(t('spreed', 'You made the conversation invisible'))
|
this.lastNotification.hideToast()
|
||||||
} else if (listable.value === CONVERSATION.LISTABLE.USERS) {
|
this.lastNotification = null
|
||||||
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 (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) {
|
} catch (e) {
|
||||||
console.error('Error occurred when updating the conversation visibility', e)
|
console.error('Error occurred when opening or limiting the conversation', e)
|
||||||
showError(t('spreed', 'Error occurred when updating the conversation visibility'))
|
showError(t('spreed', 'Error occurred when opening or limiting the conversation'))
|
||||||
this.listable = this.conversation.listable
|
this.listable = this.conversation.listable
|
||||||
}
|
}
|
||||||
this.isListableLoading = false
|
this.isListableLoading = false
|
||||||
|
@ -133,4 +156,8 @@ export default {
|
||||||
.listable-options-select {
|
.listable-options-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.indent {
|
||||||
|
margin-left: 26px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -332,27 +332,27 @@ class SystemMessageTest extends TestCase {
|
||||||
['actor' => ['id' => 'actor', 'type' => 'user']],
|
['actor' => ['id' => 'actor', 'type' => 'user']],
|
||||||
],
|
],
|
||||||
['listable_none', [], 'recipient',
|
['listable_none', [], 'recipient',
|
||||||
'{actor} made the conversation invisible',
|
'{actor} limited the conversation to the current participants',
|
||||||
['actor' => ['id' => 'actor', 'type' => 'user']],
|
['actor' => ['id' => 'actor', 'type' => 'user']],
|
||||||
],
|
],
|
||||||
['listable_none', [], 'actor',
|
['listable_none', [], 'actor',
|
||||||
'You made the conversation invisible',
|
'You limited the conversation to the current participants',
|
||||||
['actor' => ['id' => 'actor', 'type' => 'user']],
|
['actor' => ['id' => 'actor', 'type' => 'user']],
|
||||||
],
|
],
|
||||||
['listable_users', [], 'recipient',
|
['listable_users', [], 'recipient',
|
||||||
'{actor} made the conversation visible for registered users only',
|
'{actor} opened the conversation to registered users',
|
||||||
['actor' => ['id' => 'actor', 'type' => 'user']],
|
['actor' => ['id' => 'actor', 'type' => 'user']],
|
||||||
],
|
],
|
||||||
['listable_users', [], 'actor',
|
['listable_users', [], 'actor',
|
||||||
'You made the conversation visible for registered users only',
|
'You opened the conversation to registered users',
|
||||||
['actor' => ['id' => 'actor', 'type' => 'user']],
|
['actor' => ['id' => 'actor', 'type' => 'user']],
|
||||||
],
|
],
|
||||||
['listable_all', [], 'recipient',
|
['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']],
|
['actor' => ['id' => 'actor', 'type' => 'user']],
|
||||||
],
|
],
|
||||||
['listable_all', [], 'actor',
|
['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']],
|
['actor' => ['id' => 'actor', 'type' => 'user']],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче