Fix Talk conversation creation with NC22
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
b21dcf90ef
commit
c28f61c63f
|
@ -139,6 +139,7 @@ class PublicViewController extends Controller {
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'show_week_numbers', ($defaultWeekNumbers === 'yes'));
|
$this->initialStateService->provideInitialState($this->appName, 'show_week_numbers', ($defaultWeekNumbers === 'yes'));
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'skip_popover', ($defaultSkipPopover === 'yes'));
|
$this->initialStateService->provideInitialState($this->appName, 'skip_popover', ($defaultSkipPopover === 'yes'));
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'talk_enabled', false);
|
$this->initialStateService->provideInitialState($this->appName, 'talk_enabled', false);
|
||||||
|
$this->initialStateService->provideInitialState($this->appName, 'talk_api_version', 'v1');
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'timezone', $defaultTimezone);
|
$this->initialStateService->provideInitialState($this->appName, 'timezone', $defaultTimezone);
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'slot_duration', $defaultSlotDuration);
|
$this->initialStateService->provideInitialState($this->appName, 'slot_duration', $defaultSlotDuration);
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'default_reminder', $defaultDefaultReminder);
|
$this->initialStateService->provideInitialState($this->appName, 'default_reminder', $defaultDefaultReminder);
|
||||||
|
|
|
@ -110,6 +110,7 @@ class ViewController extends Controller {
|
||||||
$showTasks = $this->config->getUserValue($this->userId, $this->appName, 'showTasks', $defaultShowTasks) === 'yes';
|
$showTasks = $this->config->getUserValue($this->userId, $this->appName, 'showTasks', $defaultShowTasks) === 'yes';
|
||||||
|
|
||||||
$talkEnabled = $this->appManager->isEnabledForUser('spreed');
|
$talkEnabled = $this->appManager->isEnabledForUser('spreed');
|
||||||
|
$talkApiVersion = version_compare($this->appManager->getAppVersion('spreed'), '12.0.0', '>=') ? 'v4' : 'v1';
|
||||||
$tasksEnabled = $this->appManager->isEnabledForUser('tasks');
|
$tasksEnabled = $this->appManager->isEnabledForUser('tasks');
|
||||||
|
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'app_version', $appVersion);
|
$this->initialStateService->provideInitialState($this->appName, 'app_version', $appVersion);
|
||||||
|
@ -120,6 +121,7 @@ class ViewController extends Controller {
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'show_week_numbers', $showWeekNumbers);
|
$this->initialStateService->provideInitialState($this->appName, 'show_week_numbers', $showWeekNumbers);
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'skip_popover', $skipPopover);
|
$this->initialStateService->provideInitialState($this->appName, 'skip_popover', $skipPopover);
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'talk_enabled', $talkEnabled);
|
$this->initialStateService->provideInitialState($this->appName, 'talk_enabled', $talkEnabled);
|
||||||
|
$this->initialStateService->provideInitialState($this->appName, 'talk_api_version', $talkApiVersion);
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'timezone', $timezone);
|
$this->initialStateService->provideInitialState($this->appName, 'timezone', $timezone);
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'slot_duration', $slotDuration);
|
$this->initialStateService->provideInitialState($this->appName, 'slot_duration', $slotDuration);
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'default_reminder', $defaultReminder);
|
$this->initialStateService->provideInitialState($this->appName, 'default_reminder', $defaultReminder);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
import HTTPClient from '@nextcloud/axios'
|
import HTTPClient from '@nextcloud/axios'
|
||||||
import { translate as t } from '@nextcloud/l10n'
|
import { translate as t } from '@nextcloud/l10n'
|
||||||
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
|
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new public talk room
|
* Creates a new public talk room
|
||||||
|
@ -31,9 +32,10 @@ import { generateUrl, generateOcsUrl } from '@nextcloud/router'
|
||||||
* @returns {Promise<String>}
|
* @returns {Promise<String>}
|
||||||
*/
|
*/
|
||||||
export async function createTalkRoom(eventTitle = null) {
|
export async function createTalkRoom(eventTitle = null) {
|
||||||
|
const apiVersion = loadState('calendar', 'talk_api_version')
|
||||||
let response
|
let response
|
||||||
try {
|
try {
|
||||||
response = await HTTPClient.post(generateOcsUrl('apps/spreed/api/v1/', 2) + 'room', {
|
response = await HTTPClient.post(generateOcsUrl('apps/spreed/api/' + apiVersion + '/', 2) + 'room', {
|
||||||
roomType: 3,
|
roomType: 3,
|
||||||
roomName: eventTitle || t('calendar', 'Chat room for event'),
|
roomName: eventTitle || t('calendar', 'Chat room for event'),
|
||||||
})
|
})
|
||||||
|
|
|
@ -101,7 +101,7 @@ class PublicViewControllerTest extends TestCase {
|
||||||
->with('imagePath456')
|
->with('imagePath456')
|
||||||
->willReturn('absoluteImagePath456');
|
->willReturn('absoluteImagePath456');
|
||||||
|
|
||||||
$this->initialStateService->expects(self::exactly(13))
|
$this->initialStateService
|
||||||
->method('provideInitialState')
|
->method('provideInitialState')
|
||||||
->withConsecutive(
|
->withConsecutive(
|
||||||
['calendar', 'app_version', '1.0.0'],
|
['calendar', 'app_version', '1.0.0'],
|
||||||
|
@ -112,6 +112,7 @@ class PublicViewControllerTest extends TestCase {
|
||||||
['calendar', 'show_week_numbers', true],
|
['calendar', 'show_week_numbers', true],
|
||||||
['calendar', 'skip_popover', true],
|
['calendar', 'skip_popover', true],
|
||||||
['calendar', 'talk_enabled', false],
|
['calendar', 'talk_enabled', false],
|
||||||
|
['calendar', 'talk_api_version', 'v1'],
|
||||||
['calendar', 'timezone', 'defaultTimezone'],
|
['calendar', 'timezone', 'defaultTimezone'],
|
||||||
['calendar', 'slot_duration', 'defaultSlotDuration'],
|
['calendar', 'slot_duration', 'defaultSlotDuration'],
|
||||||
['calendar', 'default_reminder', 'defaultDefaultReminder'],
|
['calendar', 'default_reminder', 'defaultDefaultReminder'],
|
||||||
|
@ -177,7 +178,7 @@ class PublicViewControllerTest extends TestCase {
|
||||||
->with('imagePath456')
|
->with('imagePath456')
|
||||||
->willReturn('absoluteImagePath456');
|
->willReturn('absoluteImagePath456');
|
||||||
|
|
||||||
$this->initialStateService->expects(self::exactly(13))
|
$this->initialStateService
|
||||||
->method('provideInitialState')
|
->method('provideInitialState')
|
||||||
->withConsecutive(
|
->withConsecutive(
|
||||||
['calendar', 'app_version', '1.0.0'],
|
['calendar', 'app_version', '1.0.0'],
|
||||||
|
@ -188,6 +189,7 @@ class PublicViewControllerTest extends TestCase {
|
||||||
['calendar', 'show_week_numbers', true],
|
['calendar', 'show_week_numbers', true],
|
||||||
['calendar', 'skip_popover', true],
|
['calendar', 'skip_popover', true],
|
||||||
['calendar', 'talk_enabled', false],
|
['calendar', 'talk_enabled', false],
|
||||||
|
['calendar', 'talk_api_version', 'v1'],
|
||||||
['calendar', 'timezone', 'defaultTimezone'],
|
['calendar', 'timezone', 'defaultTimezone'],
|
||||||
['calendar', 'slot_duration', 'defaultSlotDuration'],
|
['calendar', 'slot_duration', 'defaultSlotDuration'],
|
||||||
['calendar', 'default_reminder', 'defaultDefaultReminder'],
|
['calendar', 'default_reminder', 'defaultDefaultReminder'],
|
||||||
|
|
|
@ -102,6 +102,11 @@ class ViewControllerTest extends TestCase {
|
||||||
['spreed', null, true],
|
['spreed', null, true],
|
||||||
['tasks', null, true]
|
['tasks', null, true]
|
||||||
]);
|
]);
|
||||||
|
$this->appManager
|
||||||
|
->method('getAppVersion')
|
||||||
|
->willReturnMap([
|
||||||
|
['spreed', true, '12.0.0'],
|
||||||
|
]);
|
||||||
|
|
||||||
$this->initialStateService
|
$this->initialStateService
|
||||||
->method('provideInitialState')
|
->method('provideInitialState')
|
||||||
|
@ -114,6 +119,7 @@ class ViewControllerTest extends TestCase {
|
||||||
['calendar', 'show_week_numbers', true],
|
['calendar', 'show_week_numbers', true],
|
||||||
['calendar', 'skip_popover', true],
|
['calendar', 'skip_popover', true],
|
||||||
['calendar', 'talk_enabled', true],
|
['calendar', 'talk_enabled', true],
|
||||||
|
['calendar', 'talk_api_version', 'v4'],
|
||||||
['calendar', 'timezone', 'Europe/Berlin'],
|
['calendar', 'timezone', 'Europe/Berlin'],
|
||||||
['calendar', 'slot_duration', '00:15:00'],
|
['calendar', 'slot_duration', '00:15:00'],
|
||||||
['calendar', 'default_reminder', '00:10:00'],
|
['calendar', 'default_reminder', '00:10:00'],
|
||||||
|
@ -167,9 +173,14 @@ class ViewControllerTest extends TestCase {
|
||||||
$this->appManager
|
$this->appManager
|
||||||
->method('isEnabledForUser')
|
->method('isEnabledForUser')
|
||||||
->willReturnMap([
|
->willReturnMap([
|
||||||
['spreed', null, true],
|
['spreed', null, false],
|
||||||
['tasks', null, false]
|
['tasks', null, false]
|
||||||
]);
|
]);
|
||||||
|
$this->appManager
|
||||||
|
->method('getAppVersion')
|
||||||
|
->willReturnMap([
|
||||||
|
['spreed', true, '11.3.0'],
|
||||||
|
]);
|
||||||
|
|
||||||
$this->initialStateService
|
$this->initialStateService
|
||||||
->method('provideInitialState')
|
->method('provideInitialState')
|
||||||
|
@ -181,7 +192,8 @@ class ViewControllerTest extends TestCase {
|
||||||
['calendar', 'show_weekends', true],
|
['calendar', 'show_weekends', true],
|
||||||
['calendar', 'show_week_numbers', true],
|
['calendar', 'show_week_numbers', true],
|
||||||
['calendar', 'skip_popover', true],
|
['calendar', 'skip_popover', true],
|
||||||
['calendar', 'talk_enabled', true],
|
['calendar', 'talk_enabled', false],
|
||||||
|
['calendar', 'talk_api_version', 'v1'],
|
||||||
['calendar', 'timezone', 'Europe/Berlin'],
|
['calendar', 'timezone', 'Europe/Berlin'],
|
||||||
['calendar', 'slot_duration', '00:15:00'],
|
['calendar', 'slot_duration', '00:15:00'],
|
||||||
['calendar', 'default_reminder', '00:10:00'],
|
['calendar', 'default_reminder', '00:10:00'],
|
||||||
|
|
Loading…
Reference in New Issue