summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2019-08-21 10:49:06 -0100
committerMaxence Lange <maxence@artificial-owl.com>2019-08-22 18:34:38 -0100
commit3292520f2d83e276829d8d0012029592b9e80596 (patch)
tree0fd2ca66afc7086d61c59e7f1a27c9f6e649d938
parentafe2f7732fe5f5eb62ceb046a1a494a20822709d (diff)
some renaming
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/Controller/LocalController.php6
-rw-r--r--lib/Db/CacheActorsRequest.php4
-rw-r--r--lib/Model/ActivityPub/ACore.php18
-rw-r--r--lib/Service/ActorService.php2
4 files changed, 21 insertions, 9 deletions
diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php
index d3adb361..bd0bae2a 100644
--- a/lib/Controller/LocalController.php
+++ b/lib/Controller/LocalController.php
@@ -325,11 +325,11 @@ class LocalController extends Controller {
public function postUnlike(string $postId): DataResponse {
try {
$this->initViewer(true);
- $announce = $this->likeService->delete($this->viewer, $postId, $token);
+ $like = $this->likeService->delete($this->viewer, $postId, $token);
return $this->success(
[
- 'like' => $announce,
+ 'like' => $like,
'token' => $token
]
);
@@ -728,7 +728,7 @@ class LocalController extends Controller {
public function globalActorAvatar(string $id): Response {
try {
$actor = $this->cacheActorService->getFromId($id);
- if ($actor->gotIcon()) {
+ if ($actor->hasIcon()) {
$avatar = $actor->getIcon();
$mime = '';
$document = $this->documentService->getFromCache($avatar->getId(), $mime);
diff --git a/lib/Db/CacheActorsRequest.php b/lib/Db/CacheActorsRequest.php
index 3867d7bd..416fe1c8 100644
--- a/lib/Db/CacheActorsRequest.php
+++ b/lib/Db/CacheActorsRequest.php
@@ -102,7 +102,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
} catch (Exception $e) {
}
- if ($actor->gotIcon()) {
+ if ($actor->hasIcon()) {
$iconId = $actor->getIcon()
->getId();
} else {
@@ -160,7 +160,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
} catch (Exception $e) {
}
- if ($actor->gotIcon()) {
+ if ($actor->hasIcon()) {
$iconId = $actor->getIcon()
->getId();
} else {
diff --git a/lib/Model/ActivityPub/ACore.php b/lib/Model/ActivityPub/ACore.php
index 471968f7..d4ee7870 100644
--- a/lib/Model/ActivityPub/ACore.php
+++ b/lib/Model/ActivityPub/ACore.php
@@ -171,6 +171,18 @@ class ACore extends Item implements JsonSerializable {
return $this;
}
+ /**
+ * @return string
+ */
+ public function getObjectId(): string {
+ if ($this->hasObject()) {
+ return $this->getObject()
+ ->getId();
+ }
+
+ return parent::getObjectId();
+ }
+
/**
* @param bool $filter - will remove general url like Public
@@ -191,7 +203,7 @@ class ACore extends Item implements JsonSerializable {
/**
* @return bool
*/
- public function gotIcon(): bool {
+ public function hasIcon(): bool {
if ($this->icon === null) {
return false;
}
@@ -306,7 +318,7 @@ class ACore extends Item implements JsonSerializable {
$origin = $this->getRoot()
->getOrigin();
- if ($origin === $host) {
+ if ($origin === $host && $host !== '') {
return;
}
@@ -684,7 +696,7 @@ class ACore extends Item implements JsonSerializable {
}
// TODO - moving the $this->icon to Model/Person ?
- if ($this->gotIcon()) {
+ if ($this->hasIcon()) {
$this->addEntryItem('icon', $this->getIcon());
}
diff --git a/lib/Service/ActorService.php b/lib/Service/ActorService.php
index 78b6620c..429ebf88 100644
--- a/lib/Service/ActorService.php
+++ b/lib/Service/ActorService.php
@@ -131,7 +131,7 @@ class ActorService {
* @param Person $actor
*/
private function cacheDocumentIfNeeded(Person $actor) {
- if ($actor->gotIcon()) {
+ if ($actor->hasIcon()) {
$icon = $actor->getIcon();
try {
$cache = $this->cacheDocumentsRequest->getByUrl($icon->getUrl());