diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AppInfo/Application.php | 1 | ||||
-rw-r--r-- | lib/Command/QueueProcess.php | 2 | ||||
-rw-r--r-- | lib/Controller/ActivityPubController.php | 7 | ||||
-rw-r--r-- | lib/Controller/ConfigController.php | 17 | ||||
-rw-r--r-- | lib/Controller/LocalController.php | 3 | ||||
-rw-r--r-- | lib/Controller/NavigationController.php | 20 | ||||
-rw-r--r-- | lib/Controller/QueueController.php | 2 | ||||
-rw-r--r-- | lib/Controller/SocialPubController.php | 2 | ||||
-rw-r--r-- | lib/Cron/Queue.php | 7 | ||||
-rw-r--r-- | lib/Db/CacheActorsRequest.php | 27 | ||||
-rw-r--r-- | lib/Db/FollowsRequestBuilder.php | 16 | ||||
-rw-r--r-- | lib/Db/RequestQueueRequest.php | 1 | ||||
-rw-r--r-- | lib/Service/ActivityPub/NoteService.php | 5 | ||||
-rw-r--r-- | lib/Service/ActivityService.php | 4 | ||||
-rw-r--r-- | lib/Service/ConfigService.php | 2 | ||||
-rw-r--r-- | lib/Service/CurlService.php | 2 | ||||
-rw-r--r-- | lib/Service/MiscService.php | 1 | ||||
-rw-r--r-- | lib/Service/PostService.php | 1 | ||||
-rw-r--r-- | lib/Service/QueueService.php | 1 |
19 files changed, 29 insertions, 92 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 243217e2..d20ff7f1 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -32,7 +32,6 @@ namespace OCA\Social\AppInfo; use OCP\AppFramework\App; -use OCP\AppFramework\IAppContainer; class Application extends App { diff --git a/lib/Command/QueueProcess.php b/lib/Command/QueueProcess.php index 780a87da..d9991b9d 100644 --- a/lib/Command/QueueProcess.php +++ b/lib/Command/QueueProcess.php @@ -31,9 +31,7 @@ declare(strict_types=1); namespace OCA\Social\Command; -use Exception; use OC\Core\Command\Base; -use OCA\Social\Exceptions\ActorDoesNotExistException; use OCA\Social\Exceptions\RequestException; use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Service\ActivityService; diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php index a958f7bc..83646e36 100644 --- a/lib/Controller/ActivityPubController.php +++ b/lib/Controller/ActivityPubController.php @@ -74,9 +74,6 @@ class ActivityPubController extends Controller { /** @var MiscService */ private $miscService; - /** @var NavigationController */ - private $navigationController; - /** * ActivityPubController constructor. @@ -94,13 +91,11 @@ class ActivityPubController extends Controller { IRequest $request, SocialPubController $socialPubController, ActivityService $activityService, ImportService $importService, FollowService $followService, ActorService $actorService, NotesRequest $notesRequest, - NavigationController $navigationController, MiscService $miscService ) { parent::__construct(Application::APP_NAME, $request); $this->socialPubController = $socialPubController; - $this->navigationController = $navigationController; $this->activityService = $activityService; $this->importService = $importService; @@ -258,7 +253,7 @@ class ActivityPubController extends Controller { * * @return Response */ - public function followers(string $username, $data): Response { + public function followers(string $username): Response { if (!$this->checkSourceActivityStreams()) { return $this->socialPubController->followers($username); diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index dc2ee989..3059ec14 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -25,11 +25,8 @@ declare(strict_types=1); namespace OCA\Social\Controller; -use OCA\Activity\Data; -use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Service\ConfigService; use OCP\AppFramework\Controller; -use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; @@ -46,16 +43,12 @@ class ConfigController extends Controller { /** * @param string $cloudAddress + * * @return DataResponse */ public function setCloudAddress(string $cloudAddress): DataResponse { - try { - $this->configService->setCloudAddress($cloudAddress); - return new DataResponse([]); - } catch (SocialAppConfigException $e) { - return new DataResponse([ - 'message' => $e->getMessage() - ], Http::STATUS_BAD_REQUEST); - } + $this->configService->setCloudAddress($cloudAddress); + + return new DataResponse([]); } -}
\ No newline at end of file +} diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index 73a05cec..03dba180 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -219,6 +219,9 @@ class LocalController extends Controller { * @NoAdminRequired * @NoSubAdminRequired * + * @param int $since + * @param int $limit + * * @return DataResponse */ public function streamDirect(int $since = 0, int $limit = 5): DataResponse { diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index b14f46bd..0911b12f 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -30,11 +30,9 @@ declare(strict_types=1); namespace OCA\Social\Controller; -use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; +use daita\MySmallPhpTools\Traits\TArrayTools; use Exception; -use OC\Files\Node\File; -use OC\Files\SimpleFS\SimpleFile; use OC\User\NoUserException; use OCA\Social\AppInfo\Application; use OCA\Social\Exceptions\AccountAlreadyExistsException; @@ -48,9 +46,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; -use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\Response; -use OCP\AppFramework\Http\Template\PublicTemplateResponse; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IL10N; @@ -132,9 +128,11 @@ class NavigationController extends Controller { * @NoAdminRequired * @NoSubAdminRequired * + * @param string $path + * * @return TemplateResponse */ - public function navigate($path = ''): TemplateResponse { + public function navigate(string $path = ''): TemplateResponse { $data = [ 'serverData' => [ 'public' => false, @@ -230,10 +228,11 @@ class NavigationController extends Controller { * @NoAdminRequired * @NoSubAdminRequired * + * @param string $path + * * @return TemplateResponse - * @throws NoUserException */ - public function timeline($path = ''): TemplateResponse { + public function timeline(string $path = ''): TemplateResponse { return $this->navigate(); } @@ -244,10 +243,11 @@ class NavigationController extends Controller { * @NoAdminRequired * @NoSubAdminRequired * + * @param string $path + * * @return TemplateResponse - * @throws NoUserException */ - public function account($path = ''): TemplateResponse { + public function account(string $path = ''): TemplateResponse { return $this->navigate(); } diff --git a/lib/Controller/QueueController.php b/lib/Controller/QueueController.php index 26cdddfa..c85dee2b 100644 --- a/lib/Controller/QueueController.php +++ b/lib/Controller/QueueController.php @@ -32,12 +32,10 @@ namespace OCA\Social\Controller; use daita\MySmallPhpTools\Traits\TAsync; use OCA\Social\AppInfo\Application; -use OCA\Social\Exceptions\ActorDoesNotExistException; use OCA\Social\Exceptions\RequestException; use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Model\RequestQueue; use OCA\Social\Service\ActivityService; -use OCA\Social\Service\CurlService; use OCA\Social\Service\MiscService; use OCA\Social\Service\QueueService; use OCP\AppFramework\Controller; diff --git a/lib/Controller/SocialPubController.php b/lib/Controller/SocialPubController.php index f0ddb1d4..efd35049 100644 --- a/lib/Controller/SocialPubController.php +++ b/lib/Controller/SocialPubController.php @@ -137,7 +137,7 @@ class SocialPubController extends Controller { } catch (CacheActorDoesNotExistException $e) { return new NotFoundResponse(); } catch (Exception $e) { - $this->fail($e); + return $this->fail($e); } } diff --git a/lib/Cron/Queue.php b/lib/Cron/Queue.php index 58e759a4..1dd1b8c4 100644 --- a/lib/Cron/Queue.php +++ b/lib/Cron/Queue.php @@ -31,18 +31,11 @@ declare(strict_types=1); namespace OCA\Social\Cron; -use Exception; use OC\BackgroundJob\TimedJob; use OCA\Social\AppInfo\Application; -use OCA\Social\Exceptions\ActorDoesNotExistException; use OCA\Social\Exceptions\RequestException; use OCA\Social\Exceptions\SocialAppConfigException; -use OCA\Social\Service\ActivityPub\DocumentService; -use OCA\Social\Service\ActivityPub\PersonService; use OCA\Social\Service\ActivityService; -use OCA\Social\Service\ActorService; -use OCA\Social\Service\CacheService; -use OCA\Social\Service\ConfigService; use OCA\Social\Service\MiscService; use OCA\Social\Service\QueueService; use OCP\AppFramework\QueryException; diff --git a/lib/Db/CacheActorsRequest.php b/lib/Db/CacheActorsRequest.php index 1be44384..3a9a07b0 100644 --- a/lib/Db/CacheActorsRequest.php +++ b/lib/Db/CacheActorsRequest.php @@ -202,32 +202,6 @@ class CacheActorsRequest extends CacheActorsRequestBuilder { /** - * get Cached version of a local Actor, based on the preferred username - * - * @param string $account - * - * @return Person - * @throws CacheActorDoesNotExistException - */ - public function getFromLocalAccount(string $account): Person { - $qb = $this->getCacheActorsSelectSql(); - $this->limitToPreferredUsername($qb, $account); - $this->limitToLocal($qb, true); - $this->leftJoinCacheDocuments($qb, 'icon_id'); - - $cursor = $qb->execute(); - $data = $cursor->fetch(); - $cursor->closeCursor(); - - if ($data === false) { - throw new CacheActorDoesNotExistException(); - } - - return $this->parseCacheActorsSelectSql($data); - } - - - /** * @param string $search * @param string $viewerId * @@ -243,7 +217,6 @@ class CacheActorsRequest extends CacheActorsRequestBuilder { $this->leftJoinFollowAsViewer($qb, 'id', $viewerId, false, 'as_followed'); } - $accounts = []; $cursor = $qb->execute(); while ($data = $cursor->fetch()) { diff --git a/lib/Db/FollowsRequestBuilder.php b/lib/Db/FollowsRequestBuilder.php index 3a1d9445..0f50b37e 100644 --- a/lib/Db/FollowsRequestBuilder.php +++ b/lib/Db/FollowsRequestBuilder.php @@ -109,22 +109,6 @@ class FollowsRequestBuilder extends CoreRequestBuilder { /** - * Base of the Sql Select request for Shares - * - * @return IQueryBuilder - */ - protected function countFollowsSelectSql(): IQueryBuilder { - $qb = $this->dbConnection->getQueryBuilder(); - $qb->selectAlias($qb->createFunction('COUNT(*)'), 'count') - ->from(self::TABLE_SERVER_FOLLOWS, 'f'); - - $this->defaultSelectAlias = 'f'; - - return $qb; - } - - - /** * Base of the Sql Delete request * * @return IQueryBuilder diff --git a/lib/Db/RequestQueueRequest.php b/lib/Db/RequestQueueRequest.php index 4e07ffba..941c1913 100644 --- a/lib/Db/RequestQueueRequest.php +++ b/lib/Db/RequestQueueRequest.php @@ -35,7 +35,6 @@ use DateTime; use Exception; use OCA\Social\Exceptions\QueueStatusException; use OCA\Social\Model\RequestQueue; -use OCA\Social\Service\QueueService; use OCP\DB\QueryBuilder\IQueryBuilder; diff --git a/lib/Service/ActivityPub/NoteService.php b/lib/Service/ActivityPub/NoteService.php index e457e135..ebce852b 100644 --- a/lib/Service/ActivityPub/NoteService.php +++ b/lib/Service/ActivityPub/NoteService.php @@ -336,9 +336,12 @@ class NoteService implements ICoreService { /** * @param Person $actor * + * @param int $since + * @param int $limit + * * @return Note[] */ - public function getDirectNotesForActor(Person $actor, $since, $limit): array { + public function getDirectNotesForActor(Person $actor, int $since = 0, int $limit = 5): array { return $this->notesRequest->getDirectNotesForActorId($actor->getId(), $since, $limit); } diff --git a/lib/Service/ActivityService.php b/lib/Service/ActivityService.php index 37bf5606..57ba561c 100644 --- a/lib/Service/ActivityService.php +++ b/lib/Service/ActivityService.php @@ -284,8 +284,12 @@ class ActivityService { ); } catch (ActorDoesNotExistException $e) { $this->queueService->deleteRequest($queue); + + return; } catch (Request410Exception $e) { $this->queueService->deleteRequest($queue); + + return; } try { diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 968859dd..83741f16 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -237,8 +237,6 @@ class ConfigService { /** * @param string $cloudAddress - * - * @return string */ public function setCloudAddress(string $cloudAddress) { $this->setAppValue(self::SOCIAL_ADDRESS, $cloudAddress); diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php index 2218a52d..e073cdf7 100644 --- a/lib/Service/CurlService.php +++ b/lib/Service/CurlService.php @@ -249,8 +249,6 @@ class CurlService { /** * @param int $code * - * @param Request $request - * * @throws Request410Exception */ private function parseRequestResultCode410(int $code) { diff --git a/lib/Service/MiscService.php b/lib/Service/MiscService.php index 0feb57fc..6be52d60 100644 --- a/lib/Service/MiscService.php +++ b/lib/Service/MiscService.php @@ -31,7 +31,6 @@ declare(strict_types=1); namespace OCA\Social\Service; -use Exception; use OC\User\NoUserException; use OCA\Social\AppInfo\Application; use OCP\ILogger; diff --git a/lib/Service/PostService.php b/lib/Service/PostService.php index 980b6089..0ea482be 100644 --- a/lib/Service/PostService.php +++ b/lib/Service/PostService.php @@ -33,7 +33,6 @@ namespace OCA\Social\Service; use Exception; use OC\User\NoUserException; use OCA\Social\Exceptions\ActorDoesNotExistException; -use OCA\Social\Exceptions\RequestException; use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Model\ActivityPub\ACore; use OCA\Social\Model\Post; diff --git a/lib/Service/QueueService.php b/lib/Service/QueueService.php index 36cc46dd..d7228acb 100644 --- a/lib/Service/QueueService.php +++ b/lib/Service/QueueService.php @@ -78,6 +78,7 @@ class QueueService { /** * @param array $instancePaths * @param ACore $item + * @param string $author * * @return string * @throws Exception |