diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Activity/Provider/Base.php | 1 | ||||
-rw-r--r-- | lib/BackgroundJob/CheckReferenceIdColumn.php | 68 | ||||
-rw-r--r-- | lib/Capabilities.php | 92 | ||||
-rw-r--r-- | lib/Chat/Changelog/Manager.php | 4 | ||||
-rw-r--r-- | lib/Config.php | 3 | ||||
-rw-r--r-- | lib/Controller/ChatController.php | 2 | ||||
-rw-r--r-- | lib/Controller/RoomController.php | 7 | ||||
-rw-r--r-- | lib/Flow/Operation.php | 3 | ||||
-rw-r--r-- | lib/Manager.php | 4 | ||||
-rw-r--r-- | lib/Settings/Admin/AdminSettings.php | 9 | ||||
-rw-r--r-- | lib/Share/RoomShareProvider.php | 9 | ||||
-rw-r--r-- | lib/TInitialState.php | 4 |
12 files changed, 151 insertions, 55 deletions
diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php index 1aa7c7b03..a61a16f01 100644 --- a/lib/Activity/Provider/Base.php +++ b/lib/Activity/Provider/Base.php @@ -126,6 +126,7 @@ abstract class Base implements IProvider { 'type' => 'call', 'id' => $room->getId(), 'name' => $room->getDisplayName($userId), + 'link' => $this->url->linkToRouteAbsolute('spreed.Page.showCall', ['token' => $room->getToken()]), 'call-type' => $stringType, ]; } diff --git a/lib/BackgroundJob/CheckReferenceIdColumn.php b/lib/BackgroundJob/CheckReferenceIdColumn.php new file mode 100644 index 000000000..8badcdaf5 --- /dev/null +++ b/lib/BackgroundJob/CheckReferenceIdColumn.php @@ -0,0 +1,68 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com> + * + * @license GNU AGPL version 3 or any later version + * + * 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/>. + * + */ + +namespace OCA\Talk\BackgroundJob; + +use OC\DB\SchemaWrapper; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\IJobList; +use OCP\BackgroundJob\TimedJob; +use OCP\IConfig; +use OCP\IDBConnection; + +/** + * Class CheckReferenceIdColumn + * + * @package OCA\Talk\BackgroundJob + */ +class CheckReferenceIdColumn extends TimedJob { + + /** @var IJobList */ + protected $jobList; + /** @var IConfig */ + protected $serverConfig; + /** @var IDBConnection */ + protected $connection; + + public function __construct(ITimeFactory $timeFactory, + IJobList $jobList, + IConfig $serverConfig, + IDBConnection $connection) { + parent::__construct($timeFactory); + $this->jobList = $jobList; + $this->serverConfig = $serverConfig; + $this->connection = $connection; + $this->setInterval(3600); + } + + protected function run($argument): void { + $schema = new SchemaWrapper($this->connection); + if ($schema->hasTable('comments')) { + $table = $schema->getTable('comments'); + if ($table->hasColumn('reference_id')) { + $this->serverConfig->setAppValue('spreed', 'has_reference_id', 'yes'); + $this->jobList->remove(self::class); + } + } + } +} diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 5e2f15f6d..3a31ad556 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -54,59 +54,57 @@ class Capabilities implements IPublicCapability { return []; } - $maxChatLength = 1000; - if (version_compare($this->serverConfig->getSystemValueString('version', '0.0.0'), '16.0.2', '>=')) { - $maxChatLength = ChatManager::MAX_CHAT_LENGTH; - } - - $attachments = [ - 'allowed' => $user instanceof IUser, + $capabilities = [ + 'features' => [ + 'audio', + 'video', + 'chat-v2', + 'conversation-v2', + 'guest-signaling', + 'empty-group-room', + 'guest-display-names', + 'multi-room-users', + 'favorites', + 'last-room-activity', + 'no-ping', + 'system-messages', + 'mention-flag', + 'in-call-flags', + 'notification-levels', + 'invite-groups-and-mails', + 'locked-one-to-one-rooms', + 'read-only-rooms', + 'chat-read-marker', + 'webinary-lobby', + 'start-call-flag', + 'chat-replies', + 'circles-support', + 'force-mute', + ], + 'config' => [ + 'attachments' => [ + 'allowed' => $user instanceof IUser, + ], + 'chat' => [ + 'max-length' => ChatManager::MAX_CHAT_LENGTH, + ], + 'conversations' => [], + ], ]; + if ($user instanceof IUser) { - $attachments['folder'] = $this->talkConfig->getAttachmentFolder($user->getUID()); + $capabilities['config']['attachments']['folder'] = $this->talkConfig->getAttachmentFolder($user->getUID()); } - $conversations = [ - 'can-create' => $user instanceof IUser && !$this->talkConfig->isNotAllowedToCreateConversations($user), - ]; + $capabilities['config']['conversations']['can-create'] = $user instanceof IUser && !$this->talkConfig->isNotAllowedToCreateConversations($user); + + + if ($this->serverConfig->getAppValue('spreed', 'has_reference_id', 'no') === 'yes') { + $capabilities['features'][] = 'chat-reference-id'; + } return [ - 'spreed' => [ - 'features' => [ - 'audio', - 'video', - 'chat-v2', - 'conversation-v2', - 'guest-signaling', - 'empty-group-room', - 'guest-display-names', - 'multi-room-users', - 'favorites', - 'last-room-activity', - 'no-ping', - 'system-messages', - 'mention-flag', - 'in-call-flags', - 'notification-levels', - 'invite-groups-and-mails', - 'locked-one-to-one-rooms', - 'read-only-rooms', - 'chat-read-marker', - 'webinary-lobby', - 'start-call-flag', - 'chat-replies', - 'circles-support', - 'force-mute', - 'chat-reference-id', - ], - 'config' => [ - 'attachments' => $attachments, - 'chat' => [ - 'max-length' => $maxChatLength, - ], - 'conversations' => $conversations, - ], - ], + 'spreed' => $capabilities, ]; } } diff --git a/lib/Chat/Changelog/Manager.php b/lib/Chat/Changelog/Manager.php index 04b45fbcf..0d8661b41 100644 --- a/lib/Chat/Changelog/Manager.php +++ b/lib/Chat/Changelog/Manager.php @@ -98,6 +98,10 @@ class Manager { $this->l->t('- You can now directly reply to messages giving the other users more context what your message is about'), $this->l->t('- Searching for conversations and participants will now also filter your existing conversations, making it much easier to find previous conversations'), $this->l->t('- You can now add custom user groups to conversations when the circles app is installed'), + $this->l->t('New in Talk 9'), + $this->l->t('- Check out the new grid and call view'), + $this->l->t('- You can now upload and drag\'n\'drop files directly from your device into the chat'), + $this->l->t('- Shared files are now opened directly inside the chat view with the viewer apps'), ]; } } diff --git a/lib/Config.php b/lib/Config.php index 3bef58717..5f14be44c 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -235,7 +235,7 @@ class Config { ]; } - public function getSignalingMode(): string { + public function getSignalingMode($cleanExternalSignaling = true): string { $validModes = [ self::SIGNALING_INTERNAL, self::SIGNALING_EXTERNAL, @@ -252,6 +252,7 @@ class Config { return self::SIGNALING_INTERNAL; } if ($numSignalingServers === 1 + && $cleanExternalSignaling && $this->config->getAppValue('spreed', 'signaling_dev', 'no') === 'no') { return self::SIGNALING_EXTERNAL; } diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index 1f4afbe2b..3e9b793e8 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -305,7 +305,7 @@ class ChatController extends AEnvironmentAwareController { $commentKey = $commentIdToIndex[$commentId]; // Parent is already parsed in the message list - if (!empty($commentIdToIndex[$parentId])) { + if (isset($commentIdToIndex[$parentId])) { $parentKey = $commentIdToIndex[$parentId]; $messages[$commentKey]['parent'] = $messages[$parentKey]; diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index ccf2bcc5a..b9f055129 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -127,6 +127,13 @@ class RoomController extends AEnvironmentAwareController { 'X-Nextcloud-Talk-Hash' => sha1( $this->config->getSystemValueString('version') . '#' . $this->config->getAppValue('spreed', 'installed_version', '') . '#' . + $this->config->getAppValue('spreed', 'stun_servers', '') . '#' . + $this->config->getAppValue('spreed', 'turn_servers', '') . '#' . + $this->config->getAppValue('spreed', 'signaling_servers', '') . '#' . + $this->config->getAppValue('spreed', 'signaling_mode', '') . '#' . + $this->config->getAppValue('spreed', 'allowed_groups', '') . '#' . + $this->config->getAppValue('spreed', 'start_conversations', '') . '#' . + $this->config->getAppValue('spreed', 'has_reference_id', '') . '#' . $this->config->getAppValue('theming', 'cachebuster', '1') )]; } diff --git a/lib/Flow/Operation.php b/lib/Flow/Operation.php index 0c97e1669..dd152218a 100644 --- a/lib/Flow/Operation.php +++ b/lib/Flow/Operation.php @@ -141,7 +141,8 @@ class Operation implements IOperation { $participant->getUser(), $this->prepareMention($mode, $participant) . $message, new \DateTime(), - null + null, + '' ); } catch (UnexpectedValueException $e) { continue; diff --git a/lib/Manager.php b/lib/Manager.php index 2c5c0a8dd..c96e5f2c8 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -813,8 +813,8 @@ class Manager { } $roomName = implode(', ', $displayNames); - if (strlen($roomName) > 128) { - $roomName = substr($roomName, 120) . '…'; + if (mb_strlen($roomName) > 64) { + $roomName = mb_substr($roomName, 0, 60) . '…'; } return $roomName; } diff --git a/lib/Settings/Admin/AdminSettings.php b/lib/Settings/Admin/AdminSettings.php index 751c187aa..57196c6d0 100644 --- a/lib/Settings/Admin/AdminSettings.php +++ b/lib/Settings/Admin/AdminSettings.php @@ -29,6 +29,7 @@ use OCA\Talk\Participant; use OCA\Talk\Room; use OCA\Talk\Service\CommandService; use OCP\AppFramework\Http\TemplateResponse; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IInitialStateService; use OCP\Settings\ISettings; @@ -43,15 +44,19 @@ class AdminSettings implements ISettings { private $commandService; /** @var IInitialStateService */ private $initialStateService; + /** @var ICacheFactory */ + private $memcacheFactory; public function __construct(Config $talkConfig, IConfig $serverConfig, CommandService $commandService, - IInitialStateService $initialStateService) { + IInitialStateService $initialStateService, + ICacheFactory $memcacheFactory) { $this->talkConfig = $talkConfig; $this->serverConfig = $serverConfig; $this->commandService = $commandService; $this->initialStateService = $initialStateService; + $this->memcacheFactory = $memcacheFactory; } /** @@ -100,6 +105,8 @@ class AdminSettings implements ISettings { } protected function initSignalingServers(): void { + $this->initialStateService->provideInitialState('talk', 'has_cache_configured', $this->memcacheFactory->isAvailable()); + $this->initialStateService->provideInitialState('talk', 'signaling_mode', $this->talkConfig->getSignalingMode(false)); $this->initialStateService->provideInitialState('talk', 'signaling_servers', [ 'servers' => $this->talkConfig->getSignalingServers(), 'secret' => $this->talkConfig->getSignalingSecret(), diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php index 2f93ead11..d94cbb640 100644 --- a/lib/Share/RoomShareProvider.php +++ b/lib/Share/RoomShareProvider.php @@ -28,6 +28,7 @@ declare(strict_types=1); namespace OCA\Talk\Share; +use OC\Files\Cache\Cache; use OCA\Talk\Events\ParticipantEvent; use OCA\Talk\Events\RemoveUserEvent; use OCA\Talk\Events\RoomEvent; @@ -310,6 +311,14 @@ class RoomShareProvider implements IShareProvider { $share->setProviderId($this->identifier()); + if (isset($data['f_permissions'])) { + $entryData = $data; + $entryData['permissions'] = $entryData['f_permissions']; + $entryData['parent'] = $entryData['f_parent']; + $share->setNodeCacheEntry(Cache::cacheEntryFromData($entryData, + \OC::$server->getMimeTypeLoader())); + } + return $share; } diff --git a/lib/TInitialState.php b/lib/TInitialState.php index 5b689e53b..4482ce893 100644 --- a/lib/TInitialState.php +++ b/lib/TInitialState.php @@ -55,11 +55,11 @@ trait TInitialState { ); $signalingMode = $this->talkConfig->getSignalingMode(); - if ($signalingMode !== Config::SIGNALING_INTERNAL + if ($signalingMode === Config::SIGNALING_CLUSTER_CONVERSATION && !$this->memcacheFactory->isAvailable() && $this->serverConfig->getAppValue('spreed', 'signaling_dev', 'no') === 'no') { throw new HintException( - 'External signaling is only supported with a distributed cache' + 'High Performance Back-end clustering is only supported with a distributed cache!' ); } |