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 {
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);

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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());
}

Wyświetl plik

@ -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());