account instead of actor

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/531/head
Maxence Lange 2019-06-27 14:28:57 -01:00
rodzic 419d2a3cd2
commit 250c7392a0
2 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -97,7 +97,7 @@ class StreamRequestBuilder extends CoreRequestBuilder {
's.type', 's.to', 's.to_array', 's.cc', 's.bcc', 's.content', 's.type', 's.to', 's.to_array', 's.cc', 's.bcc', 's.content',
's.summary', 's.attachments', 's.published', 's.published_time', 's.cache', 's.summary', 's.attachments', 's.published', 's.published_time', 's.cache',
's.object_id', 's.attributed_to', 's.in_reply_to', 's.source', 's.local', 's.object_id', 's.attributed_to', 's.in_reply_to', 's.source', 's.local',
's.instances', 's.creation', 's.hidden_on_timeline' 's.instances', 's.creation', 's.hidden_on_timeline', 's.details'
) )
->from(self::TABLE_STREAMS, 's'); ->from(self::TABLE_STREAMS, 's');

Wyświetl plik

@ -53,6 +53,7 @@ use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Activity\Accept; use OCA\Social\Model\ActivityPub\Activity\Accept;
use OCA\Social\Model\ActivityPub\Activity\Reject; use OCA\Social\Model\ActivityPub\Activity\Reject;
use OCA\Social\Model\ActivityPub\Activity\Undo; use OCA\Social\Model\ActivityPub\Activity\Undo;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification; use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
use OCA\Social\Model\ActivityPub\Object\Follow; use OCA\Social\Model\ActivityPub\Object\Follow;
use OCA\Social\Model\InstancePath; use OCA\Social\Model\InstancePath;
@ -146,7 +147,7 @@ class FollowInterface implements IActivityPubInterface {
$actor = $this->cacheActorService->getFromId($follow->getObjectId()); $actor = $this->cacheActorService->getFromId($follow->getObjectId());
$this->accountService->cacheLocalActorDetailCount($actor); $this->accountService->cacheLocalActorDetailCount($actor);
$this->generateNotification($follow); $this->generateNotification($actor, $follow);
} catch (Exception $e) { } catch (Exception $e) {
$this->miscService->log( $this->miscService->log(
'exception while confirmFollowRequest: ' . get_class($e) . ' - ' . $e->getMessage(), 'exception while confirmFollowRequest: ' . get_class($e) . ' - ' . $e->getMessage(),
@ -266,22 +267,25 @@ class FollowInterface implements IActivityPubInterface {
/** /**
* @param Person $actor
* @param Follow $follow * @param Follow $follow
* *
* @throws ItemUnknownException * @throws ItemUnknownException
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
private function generateNotification(Follow $follow) { private function generateNotification(Person $actor, Follow $follow) {
/** @var SocialAppNotificationInterface $notificationInterface */ /** @var SocialAppNotificationInterface $notificationInterface */
$notificationInterface = $notificationInterface =
AP::$activityPub->getInterfaceFromType(SocialAppNotification::TYPE); AP::$activityPub->getInterfaceFromType(SocialAppNotification::TYPE);
/** @var SocialAppNotification $notification */ /** @var SocialAppNotification $notification */
$notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE); $notification = AP::$activityPub->getItemFromType(SocialAppNotification::TYPE);
$notification->addDetail('actor', $follow->getActorId()); $notification->setDetail('account', $actor->getAccount());
$notification->setDetail('url', $actor->getId());
$notification->setAttributedTo($follow->getActorId()) $notification->setAttributedTo($follow->getActorId())
->setId($follow->getId() . '/notification') ->setId($follow->getId() . '/notification')
->setSummary('{actor} is following you') ->setActorId($actor->getId())
->setSummary('{account} is following you')
->setTo($follow->getObjectId()) ->setTo($follow->getObjectId())
->setLocal(true); ->setLocal(true);