Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Controller/ChatController.php13
-rw-r--r--lib/Share/RoomShareProvider.php6
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index 1635e6852..a9fca6455 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -437,20 +437,23 @@ class ChatController extends AEnvironmentAwareController {
}
// Quickly scan messages for share IDs
- $share_ids = [];
+ $shareIds = [];
foreach ($comments as $comment) {
$verb = $comment->getVerb();
- $message = $comment->getMessage();
if ($verb === 'object_shared') {
+ $message = $comment->getMessage();
$data = json_decode($message, true);
- $parameters = $data['parameters'];
- $share_ids[] = $parameters['share'];
+ if (isset($data['parameters']['share'])) {
+ $shareIds[] = $data['parameters']['share'];
+ }
}
}
// Ignore the result for now. Retrieved Share objects will be cached by
// the RoomShareProvider and returned from the cache to
// the MessageParser without additional database queries.
- $this->shareProvider->getSharesByIds($share_ids);
+ if (!empty($shareIds)) {
+ $this->shareProvider->getSharesByIds($shareIds);
+ }
$i = 0;
$messages = $commentIdToIndex = $parentIds = [];
diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php
index 229a23267..653083d96 100644
--- a/lib/Share/RoomShareProvider.php
+++ b/lib/Share/RoomShareProvider.php
@@ -28,7 +28,7 @@ declare(strict_types=1);
namespace OCA\Talk\Share;
-use OC\Cache\CappedMemoryCache;
+use OCP\Cache\CappedMemoryCache;
use OC\Files\Cache\Cache;
use OCA\Talk\Events\AlreadySharedEvent;
use OCA\Talk\Events\RoomEvent;
@@ -84,7 +84,7 @@ class RoomShareProvider implements IShareProvider {
private IL10N $l;
private IMimeTypeLoader $mimeTypeLoader;
- private $sharesByIdCache;
+ private CappedMemoryCache $sharesByIdCache;
public function __construct(
IDBConnection $connection,
@@ -684,7 +684,7 @@ class RoomShareProvider implements IShareProvider {
* @return IShare[]
* @throws ShareNotFound
*/
- public function getSharesByIds($ids, $recipientId = null): array {
+ public function getSharesByIds(array $ids, ?string $recipientId = null): array {
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('s.*',