Browse Source

1st try default group notification setting

Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
pull/2858/head
Jakob Röhrl 6 years ago
committed by Joas Schilling
parent
commit
c63d0b905f
No known key found for this signature in database GPG Key ID: 7076EA9751AACDDA
  1. 16
      lib/Controller/RoomController.php
  2. 1
      lib/Settings/Admin/GeneralSettings.php
  3. 30
      src/views/AdminSettings/GeneralSettings.vue

16
lib/Controller/RoomController.php

@ -53,6 +53,7 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IConfig;
class RoomController extends AEnvironmentAwareController {
@ -82,6 +83,8 @@ class RoomController extends AEnvironmentAwareController {
private $timeFactory;
/** @var IL10N */
private $l10n;
/** @var IConfig */
private $config;
public function __construct(string $appName,
?string $UserId,
@ -96,7 +99,8 @@ class RoomController extends AEnvironmentAwareController {
IEventDispatcher $dispatcher,
MessageParser $messageParser,
ITimeFactory $timeFactory,
IL10N $l10n) {
IL10N $l10n,
IConfig $config) {
parent::__construct($appName, $request);
$this->session = $session;
$this->appManager = $appManager;
@ -110,6 +114,7 @@ class RoomController extends AEnvironmentAwareController {
$this->messageParser = $messageParser;
$this->timeFactory = $timeFactory;
$this->l10n = $l10n;
$this->config = $config;
}
/**
@ -244,7 +249,14 @@ class RoomController extends AEnvironmentAwareController {
if ($currentParticipant->isGuest()) {
$roomData['notificationLevel'] = Participant::NOTIFY_NEVER;
} else {
$roomData['notificationLevel'] = $room->getType() === Room::ONE_TO_ONE_CALL ? Participant::NOTIFY_ALWAYS : Participant::NOTIFY_MENTION;
if ($room->getType() === Room::ONE_TO_ONE_CALL) {
$roomData['notificationLevel'] = Participant::NOTIFY_ALWAYS;
} else {
$roomData['notificationLevel'] = (int) $this->config->getAppValue('spreed', 'default_group_notification', 1);
}
//$roomData['notificationLevel'] = $room->getType() === Room::ONE_TO_ONE_CALL ? Participant::NOTIFY_ALWAYS : Participant::NOTIFY_MENTION;
}
}

1
lib/Settings/Admin/GeneralSettings.php

@ -47,6 +47,7 @@ class GeneralSettings implements ISettings {
*/
public function getForm(): TemplateResponse {
$this->initialStateService->provideInitialState('talk', 'start_calls', (int) $this->config->getAppValue('spreed', 'start_calls', '0'));
$this->initialStateService->provideInitialState('talk', 'default_group_notification', (int) $this->config->getAppValue('spreed', 'default_group_notification', '1'));
$this->initialStateService->provideInitialState('talk', 'conversations_files', (int) $this->config->getAppValue('spreed', 'conversations_files', '1'));
$this->initialStateService->provideInitialState('talk', 'conversations_files_public_shares', (int) $this->config->getAppValue('spreed', 'conversations_files_public_shares', '1'));
return new TemplateResponse('spreed', 'settings/admin/general-settings', [], '');

30
src/views/AdminSettings/GeneralSettings.vue

@ -39,6 +39,18 @@
<em>{{ t('spreed', 'When a call has started, everyone with access to the conversation can join the call.') }}</em>
</p>
<p>
<label for="default_group_notification">{{ t('spreed', 'Default group notification') }}</label>
<Multiselect id="default_group_notification"
v-model="defaultGroupNotification"
:options="defaultGroupNotificationOptions"
:placeholder="t('spreed', 'Default group notification for new groups')"
label="label"
track-by="value"
:disabled="loading || loadingStartCalls"
@input="saveDefaultGroupNotification" />
</p>
<h3>{{ t('spreed', 'Integration into other apps') }}</h3>
<p>
@ -73,6 +85,12 @@ const startCallOptions = [
{ value: 1, label: t('spreed', 'Users and moderators') },
{ value: 2, label: t('spreed', 'Moderators only') },
]
const defaultGroupNotificationOptions = [
{ value: 0, label: t('spreed', 'All messages') },
{ value: 1, label: t('spreed', '@-mentions only') },
{ value: 2, label: t('spreed', 'Off') },
]
export default {
name: 'GeneralSettings',
@ -89,6 +107,9 @@ export default {
startCallOptions,
startCalls: startCallOptions[0],
defaultGroupNotificationOptions,
defaultGroupNotification: defaultGroupNotificationOptions[0],
conversationsFiles: true,
conversationsFilesPublicShares: true,
}
@ -112,6 +133,15 @@ export default {
}.bind(this),
})
},
saveDefaultGroupNotification() {
this.loadingStartCalls = true
OCP.AppConfig.setValue('spreed', 'default_group_notification', this.startCalls.value, {
success: function() {
this.loadingStartCalls = false
}.bind(this),
})
},
saveConversationsFiles() {
this.loadingConversationsFiles = true

Loading…
Cancel
Save