kopia lustrzana https://github.com/nextcloud/social
cleaning/merging to master
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/282/head
rodzic
51b936e482
commit
9854c65e0a
|
@ -412,7 +412,7 @@ class AP {
|
|||
break;
|
||||
|
||||
case SocialAppNotification::TYPE:
|
||||
$service = $this->notificationInterface;
|
||||
$interface = $this->notificationInterface;
|
||||
break;
|
||||
|
||||
case Person::TYPE:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 === '') {
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace OCA\Social\Exceptions;
|
||||
|
||||
class AccountAlreadyExistsException extends \Exception {
|
||||
use Exception;
|
||||
|
||||
class AccountAlreadyExistsException extends Exception {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
namespace OCA\Social\Exceptions;
|
||||
|
||||
class AccountDoesNotExistException extends \Exception {
|
||||
use Exception;
|
||||
|
||||
class AccountDoesNotExistException extends Exception {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -177,25 +177,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
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -102,6 +102,7 @@ class CacheDocumentService {
|
|||
* @throws RequestServerException
|
||||
* @throws RequestResultSizeException
|
||||
* @throws RequestResultNotJsonException
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function saveRemoteFileToCache(string $url, &$mime = '') {
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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\StreamActionDoesNotExistException;
|
||||
use OCA\Social\Model\ActivityPub\ACore;
|
||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||
use OCA\Social\Model\ActivityPub\Object\Announce;
|
||||
use OCA\Social\Model\ActivityPub\Object\Note;
|
||||
use OCA\Social\Model\ActivityPub\Stream;
|
||||
use OCA\Social\Model\InstancePath;
|
||||
use OCA\Social\Model\StreamAction;
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue