summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-05-06 07:29:07 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-05-06 07:29:07 -0100
commit9854c65e0a7976783dafa6f733d77d4a3882d6d9 (patch)
treeece3f813742dfbee4245f9a07016859339fa352b /lib
parent51b936e48263b0300e8a4c8d79da28ac44ce097d (diff)
cleaning/merging to master
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/AP.php2
-rw-r--r--lib/Controller/LocalController.php1
-rw-r--r--lib/Controller/OStatusController.php3
-rw-r--r--lib/Db/CoreRequestBuilder.php6
-rw-r--r--lib/Db/NotesRequest.php11
-rw-r--r--lib/Db/NotesRequestBuilder.php25
-rw-r--r--lib/Db/StreamActionsRequestBuilder.php1
-rw-r--r--lib/Exceptions/AccountAlreadyExistsException.php4
-rw-r--r--lib/Exceptions/AccountDoesNotExistException.php4
-rw-r--r--lib/Interfaces/Activity/FollowInterface.php252
-rw-r--r--lib/Interfaces/Object/FollowInterface.php31
-rw-r--r--lib/Migration/Version0002Date20190305091902.php2
-rw-r--r--lib/Model/ActivityPub/Item.php19
-rw-r--r--lib/Model/ActivityPub/Object/Document.php3
-rw-r--r--lib/Service/AccountService.php5
-rw-r--r--lib/Service/BoostService.php7
-rw-r--r--lib/Service/CacheDocumentService.php1
-rw-r--r--lib/Service/NoteService.php4
-rw-r--r--lib/Service/StreamActionService.php20
19 files changed, 79 insertions, 322 deletions
diff --git a/lib/AP.php b/lib/AP.php
index 255485d2..e11fb9dc 100644
--- a/lib/AP.php
+++ b/lib/AP.php
@@ -412,7 +412,7 @@ class AP {
break;
case SocialAppNotification::TYPE:
- $service = $this->notificationInterface;
+ $interface = $this->notificationInterface;
break;
case Person::TYPE:
diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php
index d77c2d8f..17606ef7 100644
--- a/lib/Controller/LocalController.php
+++ b/lib/Controller/LocalController.php
@@ -36,7 +36,6 @@ use Exception;
use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\AccountDoesNotExistException;
use OCA\Social\Exceptions\InvalidResourceException;
-use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Stream;
use OCA\Social\Model\Post;
diff --git a/lib/Controller/OStatusController.php b/lib/Controller/OStatusController.php
index 3ad8718d..cc012e87 100644
--- a/lib/Controller/OStatusController.php
+++ b/lib/Controller/OStatusController.php
@@ -79,6 +79,7 @@ class OStatusController extends Controller {
* @param AccountService $accountService
* @param CurlService $curlService
* @param MiscService $miscService
+ * @param IUserSession $userSession
*/
public function __construct(
IRequest $request, CacheActorService $cacheActorService, AccountService $accountService,
@@ -145,7 +146,7 @@ class OStatusController extends Controller {
'account' => $following->getAccount()
]
], 'guest');
- } catch (\Exception $e) {
+ } catch (Exception $e) {
return $this->fail($e);
}
}
diff --git a/lib/Db/CoreRequestBuilder.php b/lib/Db/CoreRequestBuilder.php
index 6e989a38..6a85c07c 100644
--- a/lib/Db/CoreRequestBuilder.php
+++ b/lib/Db/CoreRequestBuilder.php
@@ -69,7 +69,7 @@ class CoreRequestBuilder {
const TABLE_STREAM_ACTIONS = 'social_stream_actions';
-
+
/** @var IDBConnection */
protected $dbConnection;
@@ -451,7 +451,7 @@ class CoreRequestBuilder {
*/
protected function limitPaginate(IQueryBuilder &$qb, int $since = 0, int $limit = 5) {
if ($since > 0) {
- $dTime = new \DateTime();
+ $dTime = new DateTime();
$dTime->setTimestamp($since);
$this->limitToDBFieldDateTime($qb, 'published_time', $dTime);
}
@@ -589,7 +589,7 @@ class CoreRequestBuilder {
* @throws Exception
*/
protected function limitToSince(IQueryBuilder $qb, int $timestamp, string $field) {
- $dTime = new \DateTime();
+ $dTime = new DateTime();
$dTime->setTimestamp($timestamp);
$expr = $qb->expr();
diff --git a/lib/Db/NotesRequest.php b/lib/Db/NotesRequest.php
index 6c896114..b64daf46 100644
--- a/lib/Db/NotesRequest.php
+++ b/lib/Db/NotesRequest.php
@@ -34,7 +34,10 @@ use daita\MySmallPhpTools\Model\Cache;
use DateTime;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Exception;
+use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Exceptions\NoteNotFoundException;
+use OCA\Social\Exceptions\RedundancyLimitException;
+use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
@@ -107,6 +110,8 @@ class NotesRequest extends NotesRequestBuilder {
* Insert a new Note in the database.
*
* @param SocialAppNotification $notification
+ *
+ * @throws Exception
*/
public function saveNotification(SocialAppNotification $notification) {
$qb = $this->getNotesInsertSql();
@@ -181,7 +186,10 @@ class NotesRequest extends NotesRequestBuilder {
* @param string $id
*
* @return Stream
+ * @throws ItemUnknownException
* @throws NoteNotFoundException
+ * @throws RedundancyLimitException
+ * @throws SocialAppConfigException
*/
public function getNoteByActivityId(string $id): Stream {
if ($id === '') {
@@ -211,6 +219,9 @@ class NotesRequest extends NotesRequestBuilder {
*
* @return Stream
* @throws NoteNotFoundException
+ * @throws ItemUnknownException
+ * @throws RedundancyLimitException
+ * @throws SocialAppConfigException
*/
public function getNoteByObjectId(Person $actor, string $type, string $objectId): Stream {
if ($objectId === '') {
diff --git a/lib/Db/NotesRequestBuilder.php b/lib/Db/NotesRequestBuilder.php
index 67dba3be..30e349de 100644
--- a/lib/Db/NotesRequestBuilder.php
+++ b/lib/Db/NotesRequestBuilder.php
@@ -32,21 +32,20 @@ namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools;
use Doctrine\DBAL\Query\QueryBuilder;
-use OCA\Social\AP;
use OCA\Social\Exceptions\InvalidResourceException;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Actor\Person;
-use OCA\Social\Model\ActivityPub\Object\Note;
use OCA\Social\Model\ActivityPub\Stream;
-use OCA\Social\Exceptions\ItemUnknownException;
-use OCA\Social\Exceptions\RedundancyLimitException;
-use OCA\Social\Exceptions\SocialAppConfigException;
-use OCA\Social\Model\ActivityPub\ACore;
-use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\InstancePath;
use OCP\DB\QueryBuilder\ICompositeExpression;
use OCP\DB\QueryBuilder\IQueryBuilder;
+
+/**
+ * Class NotesRequestBuilder
+ *
+ * @package OCA\Social\Db
+ */
class NotesRequestBuilder extends CoreRequestBuilder {
@@ -91,7 +90,8 @@ class NotesRequestBuilder extends CoreRequestBuilder {
$qb->selectDistinct('sn.id')
->addSelect(
'sn.type', 'sn.to', 'sn.to_array', 'sn.cc', 'sn.bcc', 'sn.content',
- 'sn.summary', 'sn.attachments', 'sn.published', 'sn.published_time', 'sn.cache', 'sn.object_id',
+ 'sn.summary', 'sn.attachments', 'sn.published', 'sn.published_time', 'sn.cache',
+ 'sn.object_id',
'sn.attributed_to', 'sn.in_reply_to', 'sn.source', 'sn.local', 'sn.instances',
'sn.creation'
)
@@ -360,13 +360,10 @@ class NotesRequestBuilder extends CoreRequestBuilder {
/**
* @param array $data
*
- * @throws ItemUnknownException
- * @throws RedundancyLimitException
- * @throws SocialAppConfigException
* @return Stream
*/
- protected function parseNotesSelectSql($data): ACore {
- $item = AP::$activityPub->getItemFromData($data);
+ protected function parseNotesSelectSql($data): Stream {
+ $item = new Stream();
$instances = json_decode($this->get('instances', $data, '[]'), true);
if (is_array($instances)) {
@@ -386,7 +383,7 @@ class NotesRequestBuilder extends CoreRequestBuilder {
try {
$action = $this->parseStreamActionsLeftJoin($data);
- $note->setAction($action);
+ $item->setAction($action);
} catch (InvalidResourceException $e) {
}
diff --git a/lib/Db/StreamActionsRequestBuilder.php b/lib/Db/StreamActionsRequestBuilder.php
index e2afa894..c5f0da47 100644
--- a/lib/Db/StreamActionsRequestBuilder.php
+++ b/lib/Db/StreamActionsRequestBuilder.php
@@ -31,7 +31,6 @@ namespace OCA\Social\Db;
use daita\MySmallPhpTools\Traits\TArrayTools;
-use OCA\Social\Model\RequestQueue;
use OCA\Social\Model\StreamAction;
use OCP\DB\QueryBuilder\IQueryBuilder;
diff --git a/lib/Exceptions/AccountAlreadyExistsException.php b/lib/Exceptions/AccountAlreadyExistsException.php
index 4bbc36a1..16e22b4a 100644
--- a/lib/Exceptions/AccountAlreadyExistsException.php
+++ b/lib/Exceptions/AccountAlreadyExistsException.php
@@ -2,7 +2,9 @@
namespace OCA\Social\Exceptions;
-class AccountAlreadyExistsException extends \Exception {
+use Exception;
+
+class AccountAlreadyExistsException extends Exception {
}
diff --git a/lib/Exceptions/AccountDoesNotExistException.php b/lib/Exceptions/AccountDoesNotExistException.php
index a6e0f626..afea5995 100644
--- a/lib/Exceptions/AccountDoesNotExistException.php
+++ b/lib/Exceptions/AccountDoesNotExistException.php
@@ -2,7 +2,9 @@
namespace OCA\Social\Exceptions;
-class AccountDoesNotExistException extends \Exception {
+use Exception;
+
+class AccountDoesNotExistException extends Exception {
}
diff --git a/lib/Interfaces/Activity/FollowInterface.php b/lib/Interfaces/Activity/FollowInterface.php
deleted file mode 100644
index a58db0b7..00000000
--- a/lib/Interfaces/Activity/FollowInterface.php
+++ /dev/null
@@ -1,252 +0,0 @@
-<?php
-declare(strict_types=1);
-
-
-/**
- * Nextcloud - Social Support
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Maxence Lange <maxence@artificial-owl.com>
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.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\Social\Interfaces\Activity;
-
-
-use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
-use Exception;
-use OCA\Social\AP;
-use OCA\Social\Db\FollowsRequest;
-use OCA\Social\Exceptions\FollowDoesNotExistException;
-use OCA\Social\Exceptions\InvalidOriginException;
-use OCA\Social\Exceptions\InvalidResourceException;
-use OCA\Social\Exceptions\ItemNotFoundException;
-use OCA\Social\Exceptions\RedundancyLimitException;
-use OCA\Social\Exceptions\Request410Exception;
-use OCA\Social\Exceptions\RequestException;
-use OCA\Social\Exceptions\SocialAppConfigException;
-use OCA\Social\Exceptions\UnknownItemException;
-use OCA\Social\Interfaces\IActivityPubInterface;
-use OCA\Social\Interfaces\Internal\SocialAppNotificationInterface;
-use OCA\Social\Model\ActivityPub\ACore;
-use OCA\Social\Model\ActivityPub\Activity\Accept;
-use OCA\Social\Model\ActivityPub\Activity\Follow;
-use OCA\Social\Model\ActivityPub\Activity\Reject;
-use OCA\Social\Model\ActivityPub\Activity\Undo;
-use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
-use OCA\Social\Model\InstancePath;
-use OCA\Social\Service\ActivityService;
-use OCA\Social\Service\CacheActorService;
-use OCA\Social\Service\ConfigService;
-use OCA\Social\Service\MiscService;
-
-
-class FollowInterface implements IActivityPubInterface {
-
-
- /** @var FollowsRequest */
- private $followsRequest;
-
- /** @var CacheActorService */
- private $cacheActorService;
-
- /** @var ActivityService */
- private $activityService;
-
- /** @var ConfigService */
- private $configService;
-
- /** @var MiscService */
- private $miscService;
-
-
- /**
- * NoteInterface constructor.
- *
- * @param FollowsRequest $followsRequest
- * @param CacheActorService $cacheActorService
- * @param ActivityService $activityService
- * @param ConfigService $configService
- * @param MiscService $miscService
- */
- public function __construct(
- FollowsRequest $followsRequest, CacheActorService $cacheActorService,
- ActivityService $activityService, ConfigService $configService, MiscService $miscService
- ) {
- $this->followsRequest = $followsRequest;
- $this->cacheActorService = $cacheActorService;
- $this->activityService = $activityService;
- $this->configService = $configService;
- $this->miscService = $miscService;
- }
-
-
- /**
- * @param ACore $item
- */
- public function processResult(ACore $item) {
- }
-
-
- /**
- * @param Follow $follow
- */
- public function confirmFollowRequest(Follow $follow) {
- try {
- $remoteActor = $this->cacheActorService->getFromId($follow->getActorId());
-
- $accept = new Accept();
- $accept->setUrlCloud($this->configService->getCloudAddress());
- $accept->generateUniqueId('#accept/follows');
- $accept->setActorId($follow->getObjectId());
- $accept->setObject($follow);
- $follow->setParent($accept);
-
- $accept->addInstancePath(
- new InstancePath(
- $remoteActor->getInbox(), InstancePath::TYPE_INBOX, InstancePath::PRIORITY_TOP
- )
- );
-
- $this->activityService->request($accept);
- $this->followsRequest->accepted($follow);
-
- $this->generateNotification($follow);
- } catch (Exception $e) {
- $this->miscService->log(
- 'exception while confirmFollowRequest: ' . get_class($e) . ' - ' . $e->getMessage(),
- 2
- );
- }
- }
-
-
- /**
- * This method is called when saving the Follow object
- *
- * @param ACore $follow
- *
- * @throws InvalidOriginException
- * @throws InvalidResourceException
- * @throws MalformedArrayException
- * @throws Request410Exception
- * @throws RequestException
- * @throws SocialAppConfigException
- * @throws RedundancyLimitException
- * @throws UnknownItemException
- */
- public function processIncomingRequest(ACore $follow) {
- /** @var Follow $follow */
- $follow->checkOrigin($follow->getActorId());
-
- try {
- $knownFollow = $this->followsRequest->getByPersons(
- $follow->getActorId(), $follow->getObjectId()
- );
-
- if ($knownFollow->getId() === $follow->getId() && !$knownFollow->isAccepted()) {
- $this->confirmFollowRequest($follow);
- }
- } catch (FollowDoesNotExistException $e) {
- $actor = $this->cacheActorService->getFromId($follow->getObjectId());
-
- if ($actor->isLocal()) {
- $follow->setFollowId($actor->getFollowers());
- $this->followsRequest->save($follow);
- $this->confirmFollowRequest($follow);
- }
- }
-
- }
-
-
- /**
- * @param string $id
- *
- * @return ACore
- * @throws ItemNotFoundException
- */
- public function getItemById(string $id): ACore {
- throw new ItemNotFoundException();
- }
-
-
- /**
- * @param ACore $activity
- * @param ACore $item
- *
- * @throws InvalidOriginException
- */
- public function activity(Acore $activity, ACore $item) {
- /** @var Follow $item */
- if ($activity->getType() === Undo::TYPE) {
- $activity->checkOrigin($item->getId());
- $activity->checkOrigin($item->getActorId());
- $this->followsRequest->delete($item);
- }
-
- if ($activity->getType() === Reject::TYPE) {
- $activity->checkOrigin($item->getObjectId());
- $this->followsRequest->delete($item);
- }
-
- if ($activity->getType() === Accept::TYPE) {
- $activity->checkOrigin($item->getObjectId());
- $this->followsRequest->accepted($item);
- }
- }
-
-
- /**
- * @param ACore $item
- */
- public function save(ACore $item) {
- }
-
-
- /**
- * @param ACore $item
- */
- public function delete(ACore $item) {
- }
-
-
- /**
- * @param Follow $follow
- *
- * @throws UnknownItemException
- */
- private function generateNotification(Follow $follow) {
- /** @var SocialAppNotificationInterface $notificationInterface */
- $notificationInterface =
- AP::$activityPub->getInterfaceFromType(SocialAppNotification::TYPE);
-
- $notification = new SocialAppNotification();
- $notification->setId($follow->getId() . '/notification')
- ->setSummary('{actor} is following you')
- ->setTo($follow->getObjectId())
- ->setLocal(true)
- ->setAttributedTo($follow->getActorId());
- $notificationInterface->save($notification);
- }
-
-}
-
diff --git a/lib/Interfaces/Object/FollowInterface.php b/lib/Interfaces/Object/FollowInterface.php
index 1e3ccf9e..07f21e0a 100644
--- a/lib/Interfaces/Object/FollowInterface.php
+++ b/lib/Interfaces/Object/FollowInterface.php
@@ -48,10 +48,12 @@ use OCA\Social\Exceptions\RequestResultSizeException;
use OCA\Social\Exceptions\RequestServerException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Interfaces\IActivityPubInterface;
+use OCA\Social\Interfaces\Internal\SocialAppNotificationInterface;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Activity\Accept;
use OCA\Social\Model\ActivityPub\Activity\Reject;
use OCA\Social\Model\ActivityPub\Activity\Undo;
+use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
use OCA\Social\Model\ActivityPub\Object\Follow;
use OCA\Social\Model\InstancePath;
use OCA\Social\Service\AccountService;
@@ -130,7 +132,7 @@ class FollowInterface implements IActivityPubInterface {
$accept->generateUniqueId('#accept/follows');
$accept->setActorId($follow->getObjectId());
$accept->setObject($follow);
- $follow->setParent($accept);
+// $follow->setParent($accept);
$accept->addInstancePath(
new InstancePath(
@@ -143,7 +145,13 @@ class FollowInterface implements IActivityPubInterface {
$actor = $this->cacheActorService->getFromId($follow->getObjectId());
$this->accountService->cacheLocalActorDetailCount($actor);
+
+ $this->generateNotification($follow);
} catch (Exception $e) {
+ $this->miscService->log(
+ 'exception while confirmFollowRequest: ' . get_class($e) . ' - ' . $e->getMessage(),
+ 2
+ );
}
}
@@ -165,6 +173,7 @@ class FollowInterface implements IActivityPubInterface {
* @throws RequestResultSizeException
* @throws RequestServerException
* @throws RequestResultNotJsonException
+ * @throws Exception
*/
public function processIncomingRequest(ACore $follow) {
/** @var Follow $follow */
@@ -240,5 +249,25 @@ class FollowInterface implements IActivityPubInterface {
public function delete(ACore $item) {
}
+
+ /**
+ * @param Follow $follow
+ *
+ * @throws ItemUnknownException
+ */
+ private function generateNotification(Follow $follow) {
+ /** @var SocialAppNotificationInterface $notificationInterface */
+ $notificationInterface =
+ AP::$activityPub->getInterfaceFromType(SocialAppNotification::TYPE);
+
+ $notification = new SocialAppNotification();
+ $notification->setId($follow->getId() . '/notification')
+ ->setSummary('{actor} is following you')
+ ->setTo($follow->getObjectId())
+ ->setLocal(true)
+ ->setAttributedTo($follow->getActorId());
+ $notificationInterface->save($notification);
+ }
+
}
diff --git a/lib/Migration/Version0002Date20190305091902.php b/lib/Migration/Version0002Date20190305091902.php
index 69f720f4..33f7e81b 100644
--- a/lib/Migration/Version0002Date20190305091902.php
+++ b/lib/Migration/Version0002Date20190305091902.php
@@ -34,8 +34,6 @@ namespace OCA\Social\Migration;
use Closure;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\SchemaException;
-use Doctrine\DBAL\Types\Type;
-use OCA\Social\Db\CoreRequestBuilder;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
diff --git a/lib/Model/ActivityPub/Item.php b/lib/Model/ActivityPub/Item.php
index e1c2d4f5..8184ce1c 100644
--- a/lib/Model/ActivityPub/Item.php
+++ b/lib/Model/ActivityPub/Item.php
@@ -178,25 +178,6 @@ class Item {
/**
- * @return string
- */
- public function getAttributedTo(): string {
- return $this->attributedTo;
- }
-
- /**
- * @param string $attributedTo
- *
- * @return Item
- */
- public function setAttributedTo(string $attributedTo): Item {
- $this->attributedTo = $attributedTo;
-
- return $this;
- }
-
-
- /**
* @param InstancePath $instancePath
*
* @return Item
diff --git a/lib/Model/ActivityPub/Object/Document.php b/lib/Model/ActivityPub/Object/Document.php
index 932392c7..35883e06 100644
--- a/lib/Model/ActivityPub/Object/Document.php
+++ b/lib/Model/ActivityPub/Object/Document.php
@@ -32,6 +32,7 @@ namespace OCA\Social\Model\ActivityPub\Object;
use DateTime;
+use Exception;
use JsonSerializable;
use OCA\Social\Exceptions\InvalidOriginException;
use OCA\Social\Exceptions\UrlCloudException;
@@ -236,6 +237,8 @@ class Document extends ACore implements JsonSerializable {
/**
* @param array $data
+ *
+ * @throws Exception
*/
public function importFromDatabase(array $data) {
parent::importFromDatabase($data);
diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php
index 13dde24d..1c5545b2 100644
--- a/lib/Service/AccountService.php
+++ b/lib/Service/AccountService.php
@@ -236,7 +236,6 @@ class AccountService {
*
* @throws SocialAppConfigException
* @throws UrlCloudException
- * @throws ItemUnknownException
*/
public function cacheLocalActorByUsername(string $username) {
try {
@@ -313,9 +312,9 @@ class AccountService {
/**
- * @param $username
+ * @param string $username
*/
- private function checkActorUsername($username) {
+ private function checkActorUsername(string $username) {
$accepted = 'qwertyuiopasdfghjklzxcvbnm';
return;
diff --git a/lib/Service/BoostService.php b/lib/Service/BoostService.php
index 60e3b4c0..a23bf956 100644
--- a/lib/Service/BoostService.php
+++ b/lib/Service/BoostService.php
@@ -34,7 +34,9 @@ use daita\MySmallPhpTools\Traits\TStringTools;
use Exception;
use OCA\Social\AP;
use OCA\Social\Db\NotesRequest;
+use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Exceptions\NoteNotFoundException;
+use OCA\Social\Exceptions\RedundancyLimitException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Activity\Undo;
@@ -152,6 +154,9 @@ class BoostService {
*
* @return Stream
* @throws NoteNotFoundException
+ * @throws SocialAppConfigException
+ * @throws ItemUnknownException
+ * @throws RedundancyLimitException
*/
public function get(Person $actor, string $postId): Stream {
$stream = $this->notesRequest->getNoteByObjectId($actor, Announce::TYPE, $postId);
@@ -166,7 +171,9 @@ class BoostService {
* @param string $token
*
* @return ACore
+ * @throws ItemUnknownException
* @throws NoteNotFoundException
+ * @throws RedundancyLimitException
* @throws SocialAppConfigException
*/
public function delete(Person $actor, string $postId, &$token = ''): ACore {
diff --git a/lib/Service/CacheDocumentService.php b/lib/Service/CacheDocumentService.php
index cf861a2f..5738db99 100644
--- a/lib/Service/CacheDocumentService.php
+++ b/lib/Service/CacheDocumentService.php
@@ -102,6 +102,7 @@ class CacheDocumentService {
* @throws RequestServerException
* @throws RequestResultSizeException
* @throws RequestResultNotJsonException
+ * @throws NotFoundException
*/
public function saveRemoteFileToCache(string $url, &$mime = '') {
diff --git a/lib/Service/NoteService.php b/lib/Service/NoteService.php
index 5b9d8069..934d53f9 100644
--- a/lib/Service/NoteService.php
+++ b/lib/Service/NoteService.php
@@ -331,10 +331,10 @@ class NoteService {
* @param string $id
* @param bool $asViewer
*
- * @return Note
+ * @return Stream
* @throws NoteNotFoundException
*/
- public function getNoteById(string $id, bool $asViewer = false): Note {
+ public function getNoteById(string $id, bool $asViewer = false): Stream {
return $this->notesRequest->getNoteById($id, $asViewer);
}
diff --git a/lib/Service/StreamActionService.php b/lib/Service/StreamActionService.php
index 55bab13d..cc8d8354 100644
--- a/lib/Service/StreamActionService.php
+++ b/lib/Service/StreamActionService.php
@@ -30,28 +30,8 @@ declare(strict_types=1);
namespace OCA\Social\Service;
-use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
-use Exception;
-use OCA\Social\Db\NotesRequest;
use OCA\Social\Db\StreamActionsRequest;
-use OCA\Social\Exceptions\InvalidOriginException;
-use OCA\Social\Exceptions\InvalidResourceException;
-use OCA\Social\Exceptions\ItemUnknownException;
-use OCA\Social\Exceptions\NoteNotFoundException;
-use OCA\Social\Exceptions\RedundancyLimitException;
-use OCA\Social\Exceptions\RequestContentException;
-use OCA\Social\Exceptions\RequestNetworkException;
-use OCA\Social\Exceptions\RequestResultNotJsonException;
-use OCA\Social\Exceptions\RequestResultSizeException;
-use OCA\Social\Exceptions\RequestServerException;
-use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Exceptions\