Add tasks_enabled to Initial State Service

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2020-04-16 17:53:30 +02:00
parent fbdcb859ca
commit 32c1e9e95a
No known key found for this signature in database
GPG Key ID: 9D98FD9380A1CB43
6 changed files with 26 additions and 0 deletions

View File

@ -135,6 +135,7 @@ class PublicViewController extends Controller {
$this->initialStateService->provideInitialState($this->appName, 'timezone', $defaultTimezone);
$this->initialStateService->provideInitialState($this->appName, 'slot_duration', $defaultSlotDuration);
$this->initialStateService->provideInitialState($this->appName, 'show_tasks', $defaultShowTasks === 'yes');
$this->initialStateService->provideInitialState($this->appName, 'tasks_enabled', false);
return new TemplateResponse($this->appName, 'main', [
'share_url' => $this->getShareURL(),

View File

@ -108,6 +108,7 @@ class ViewController extends Controller {
$showTasks = $this->config->getUserValue($this->userId, $this->appName, 'showTasks', $defaultShowTasks) === 'yes';
$talkEnabled = $this->appManager->isEnabledForUser('spreed');
$tasksEnabled = $this->appManager->isEnabledForUser('tasks');
$this->initialStateService->provideInitialState($this->appName, 'app_version', $appVersion);
$this->initialStateService->provideInitialState($this->appName, 'event_limit', $eventLimit);
@ -120,6 +121,7 @@ class ViewController extends Controller {
$this->initialStateService->provideInitialState($this->appName, 'timezone', $timezone);
$this->initialStateService->provideInitialState($this->appName, 'slot_duration', $slotDuration);
$this->initialStateService->provideInitialState($this->appName, 'show_tasks', $showTasks);
$this->initialStateService->provideInitialState($this->appName, 'tasks_enabled', $tasksEnabled);
return new TemplateResponse($this->appName, 'main');
}

View File

@ -37,6 +37,7 @@ const state = {
skipPopover: null,
slotDuration: null,
talkEnabled: false,
tasksEnabled: false,
timezone: null,
}
@ -127,6 +128,7 @@ const mutations = {
state.skipPopover = settings.skipPopover
state.slotDuration = settings.slotDuration
state.talkEnabled = settings.talkEnabled
state.tasksEnabled = settings.tasksEnabled
state.timezone = settings.timezone
},

View File

@ -300,6 +300,7 @@ export default {
skipPopover: loadState('calendar', 'skip_popover'),
slotDuration: loadState('calendar', 'slot_duration'),
talkEnabled: loadState('calendar', 'talk_enabled'),
tasksEnabled: loadState('calendar', 'tasks_enabled'),
timezone: loadState('calendar', 'timezone'),
showTasks: loadState('calendar', 'show_tasks'),
})

View File

@ -154,6 +154,9 @@ class PublicViewControllerTest extends TestCase {
$this->initialStateService->expects($this->at(10))
->method('provideInitialState')
->with('calendar', 'show_tasks', true);
$this->initialStateService->expects($this->at(11))
->method('provideInitialState')
->with('calendar', 'tasks_enabled', false);
$response = $this->controller->publicIndexWithBranding('');
@ -259,6 +262,9 @@ class PublicViewControllerTest extends TestCase {
$this->initialStateService->expects($this->at(10))
->method('provideInitialState')
->with('calendar', 'show_tasks', false);
$this->initialStateService->expects($this->at(11))
->method('provideInitialState')
->with('calendar', 'tasks_enabled', false);
$response = $this->controller->publicIndexForEmbedding('');

View File

@ -142,6 +142,10 @@ class ViewControllerTest extends TestCase {
->method('isEnabledForUser')
->with('spreed')
->willReturn(true);
$this->appManager->expects($this->at(1))
->method('isEnabledForUser')
->with('tasks')
->willReturn(true);
$this->initialStateService->expects($this->at(0))
->method('provideInitialState')
@ -176,6 +180,9 @@ class ViewControllerTest extends TestCase {
$this->initialStateService->expects($this->at(10))
->method('provideInitialState')
->with('calendar', 'show_tasks', false);
$this->initialStateService->expects($this->at(11))
->method('provideInitialState')
->with('calendar', 'tasks_enabled', true);
$response = $this->controller->index();
@ -268,6 +275,10 @@ class ViewControllerTest extends TestCase {
->method('isEnabledForUser')
->with('spreed')
->willReturn(true);
$this->appManager->expects($this->at(1))
->method('isEnabledForUser')
->with('tasks')
->willReturn(false);
$this->initialStateService->expects($this->at(0))
->method('provideInitialState')
@ -302,6 +313,9 @@ class ViewControllerTest extends TestCase {
$this->initialStateService->expects($this->at(10))
->method('provideInitialState')
->with('calendar', 'show_tasks', false);
$this->initialStateService->expects($this->at(11))
->method('provideInitialState')
->with('calendar', 'tasks_enabled', false);
$response = $this->controller->index();