summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-12-08 10:37:17 -0100
committerMaxence Lange <maxence@artificial-owl.com>2018-12-08 10:37:17 -0100
commit1d5bf5b969235c4469dfe001a9155b7587dd6e9b (patch)
tree1e4cc9cbc05e06ebdacd842d5b06d215ede4e15f /lib
parentb534b11664118b49e3ad4ff73ca1994221689bfe (diff)
detect ghost account and avoid them
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/ActorService.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Service/ActorService.php b/lib/Service/ActorService.php
index 60bb5acb..2e4c22fb 100644
--- a/lib/Service/ActorService.php
+++ b/lib/Service/ActorService.php
@@ -264,6 +264,12 @@ class ActorService {
try {
$actor = $this->getActor($username);
+ try {
+ $this->updateCacheLocalActorName($actor);
+ } catch (NoUserException $e) {
+ return;
+ }
+
$iconId = $this->documentService->cacheLocalAvatarByUsername($actor);
$actor->setIconId($iconId);
@@ -274,7 +280,6 @@ class ActorService {
];
$actor->addDetailArray('count', $count);
- $this->updateCacheLocalActorName($actor);
$this->personService->cacheLocalActor($actor, $refresh);
} catch (ActorDoesNotExistException $e) {
@@ -284,9 +289,14 @@ class ActorService {
/**
* @param Person $actor
+ *
+ * @throws NoUserException
*/
private function updateCacheLocalActorName(Person &$actor) {
$user = $this->userManager->get($actor->getUserId());
+ if ($user === null) {
+ throw new NoUserException();
+ }
$account = $this->accountManager->getAccount($user);
try {
@@ -335,7 +345,6 @@ class ActorService {
*/
public function manageCacheLocalActors(): int {
$update = $this->actorsRequest->getAll();
-
foreach ($update as $item) {
try {
$this->cacheLocalActorByUsername($item->getPreferredUsername(), true);