Detect guests app in listable settings dialog

Expose whether the guests app (guests accounts) are enabled in initial
state.
Hide the guests checkbox if the app is disabled.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
Vincent Petry 2020-12-16 16:19:09 +01:00 коммит произвёл Joas Schilling
Родитель 7b3760356d
Коммит 8f79234c42
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
2 изменённых файлов: 8 добавлений и 6 удалений

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

@ -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())

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

@ -36,7 +36,7 @@
<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 && isGuestAppEnabled">
<div v-if="listable !== LISTABLE.NONE && isGuestsAccountsEnabled">
<input id="listable_settings_guestapp_users_checkbox"
type="checkbox"
class="checkbox"
@ -53,6 +53,7 @@
<script>
import { showError, showSuccess } from '@nextcloud/dialogs'
import { CONVERSATION } from '../../constants'
import { loadState } from '@nextcloud/initial-state'
export default {
name: 'ListableSettings',
@ -74,6 +75,7 @@ export default {
listable: null,
isListableLoading: false,
lastNotification: null,
isGuestsAccountsEnabled: loadState('talk', 'guests_accounts_enabled'),
LISTABLE: CONVERSATION.LISTABLE,
}
},
@ -82,11 +84,6 @@ export default {
conversation() {
return this.$store.getters.conversation(this.token) || this.$store.getters.dummyConversation
},
isGuestAppEnabled() {
// TODO: how ?
return true
},
},
watch: {