Skip to content

Commit

Permalink
Merge pull request #11294 from nextcloud/feat/11279/handle-federation…
Browse files Browse the repository at this point in the history
…s-invite

feat(federations): provide admin setting to enable Federation in Talk
  • Loading branch information
Antreesy authored Jan 19, 2024
2 parents 1d6447c + 56a0918 commit ea74545
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Settings/Admin/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function getForm(): TemplateResponse {
$this->initGeneralSettings();
$this->initAllowedGroups();
$this->initCommands();
$this->initFederation();
$this->initMatterbridge();
$this->initStunServers();
$this->initTurnServers();
Expand Down Expand Up @@ -109,6 +110,10 @@ protected function initCommands(): void {
$this->initialState->provideInitialState('commands', $result);
}

protected function initFederation(): void {
$this->initialState->provideInitialState('federation_enabled', $this->serverConfig->getAppValue('spreed', 'federation_enabled', 'no'));
}

protected function initMatterbridge(): void {
$error = '';
try {
Expand Down
80 changes: 80 additions & 0 deletions src/components/AdminSettings/Federation.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!--
- @copyright Copyright (c) 2024 Maksim Sukharev <antreesy.web@gmail.com>
-
- @author Maksim Sukharev <[email protected]>
-
- @license AGPL-3.0-or-later
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-->

<template>
<section id="general_settings" class="federation section">
<h2>
{{ t('spreed', 'Federation') }}
<small>{{ t('spreed', 'Beta') }}</small>
</h2>

<NcCheckboxRadioSwitch :checked="isFederationEnabled"
:disabled="loading"
type="switch"
@update:checked="saveFederationEnabled">
{{ t('spreed', 'Enable Federation in Talk app') }}
</NcCheckboxRadioSwitch>
</section>
</template>

<script>
import { loadState } from '@nextcloud/initial-state'

import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'

export default {
name: 'Federation',

components: {
NcCheckboxRadioSwitch,
},

data() {
return {
loading: false,
isFederationEnabled: loadState('spreed', 'federation_enabled') === 'yes',
}
},

methods: {
saveFederationEnabled(value) {
this.loading = true

OCP.AppConfig.setValue('spreed', 'federation_enabled', value ? 'yes' : 'no', {
success: function() {
this.loading = false
this.isFederationEnabled = value
}.bind(this),
})
},
},
}
</script>

<style scoped lang="scss">
small {
color: var(--color-warning);
border: 1px solid var(--color-warning);
border-radius: 16px;
padding: 0 9px;
}
</style>
4 changes: 4 additions & 0 deletions src/views/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<GeneralSettings />
<MatterbridgeIntegration />
<AllowedGroups />
<!-- TODO remove OC.debug when Federation feature is ready -->
<Federation v-if="OC.debug" />
<BotsSettings />
<Commands />
<WebServerSetupChecks />
Expand All @@ -41,6 +43,7 @@
import AllowedGroups from '../components/AdminSettings/AllowedGroups.vue'
import BotsSettings from '../components/AdminSettings/BotsSettings.vue'
import Commands from '../components/AdminSettings/Commands.vue'
import Federation from '../components/AdminSettings/Federation.vue'
import GeneralSettings from '../components/AdminSettings/GeneralSettings.vue'
import HostedSignalingServer from '../components/AdminSettings/HostedSignalingServer.vue'
import MatterbridgeIntegration from '../components/AdminSettings/MatterbridgeIntegration.vue'
Expand All @@ -58,6 +61,7 @@ export default {
AllowedGroups,
BotsSettings,
Commands,
Federation,
GeneralSettings,
HostedSignalingServer,
MatterbridgeIntegration,
Expand Down

0 comments on commit ea74545

Please sign in to comment.