Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
feature/noid/sql-rewrite-0929
Maxence Lange 2019-08-21 10:49:06 -01:00
rodzic afe2f7732f
commit 3292520f2d
4 zmienionych plików z 21 dodań i 9 usunięć

Wyświetl plik

@ -325,11 +325,11 @@ class LocalController extends Controller {
public function postUnlike(string $postId): DataResponse { public function postUnlike(string $postId): DataResponse {
try { try {
$this->initViewer(true); $this->initViewer(true);
$announce = $this->likeService->delete($this->viewer, $postId, $token); $like = $this->likeService->delete($this->viewer, $postId, $token);
return $this->success( return $this->success(
[ [
'like' => $announce, 'like' => $like,
'token' => $token 'token' => $token
] ]
); );
@ -728,7 +728,7 @@ class LocalController extends Controller {
public function globalActorAvatar(string $id): Response { public function globalActorAvatar(string $id): Response {
try { try {
$actor = $this->cacheActorService->getFromId($id); $actor = $this->cacheActorService->getFromId($id);
if ($actor->gotIcon()) { if ($actor->hasIcon()) {
$avatar = $actor->getIcon(); $avatar = $actor->getIcon();
$mime = ''; $mime = '';
$document = $this->documentService->getFromCache($avatar->getId(), $mime); $document = $this->documentService->getFromCache($avatar->getId(), $mime);

Wyświetl plik

@ -102,7 +102,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
} catch (Exception $e) { } catch (Exception $e) {
} }
if ($actor->gotIcon()) { if ($actor->hasIcon()) {
$iconId = $actor->getIcon() $iconId = $actor->getIcon()
->getId(); ->getId();
} else { } else {
@ -160,7 +160,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
} catch (Exception $e) { } catch (Exception $e) {
} }
if ($actor->gotIcon()) { if ($actor->hasIcon()) {
$iconId = $actor->getIcon() $iconId = $actor->getIcon()
->getId(); ->getId();
} else { } else {

Wyświetl plik

@ -171,6 +171,18 @@ class ACore extends Item implements JsonSerializable {
return $this; 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 * @param bool $filter - will remove general url like Public
@ -191,7 +203,7 @@ class ACore extends Item implements JsonSerializable {
/** /**
* @return bool * @return bool
*/ */
public function gotIcon(): bool { public function hasIcon(): bool {
if ($this->icon === null) { if ($this->icon === null) {
return false; return false;
} }
@ -306,7 +318,7 @@ class ACore extends Item implements JsonSerializable {
$origin = $this->getRoot() $origin = $this->getRoot()
->getOrigin(); ->getOrigin();
if ($origin === $host) { if ($origin === $host && $host !== '') {
return; return;
} }
@ -684,7 +696,7 @@ class ACore extends Item implements JsonSerializable {
} }
// TODO - moving the $this->icon to Model/Person ? // TODO - moving the $this->icon to Model/Person ?
if ($this->gotIcon()) { if ($this->hasIcon()) {
$this->addEntryItem('icon', $this->getIcon()); $this->addEntryItem('icon', $this->getIcon());
} }

Wyświetl plik

@ -131,7 +131,7 @@ class ActorService {
* @param Person $actor * @param Person $actor
*/ */
private function cacheDocumentIfNeeded(Person $actor) { private function cacheDocumentIfNeeded(Person $actor) {
if ($actor->gotIcon()) { if ($actor->hasIcon()) {
$icon = $actor->getIcon(); $icon = $actor->getIcon();
try { try {
$cache = $this->cacheDocumentsRequest->getByUrl($icon->getUrl()); $cache = $this->cacheDocumentsRequest->getByUrl($icon->getUrl());