Use avatar endpoint if no actor_info is available

Signed-off-by: Julius Härtl <jus@bitgrid.net>
alpha1
Julius Härtl 2018-11-29 13:57:12 +01:00
rodzic 5627236d32
commit 53b5cc29e7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4C614C6ED2CDE6DF
2 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -46,6 +46,8 @@ use OCA\Social\Service\MiscService;
use OCA\Social\Service\PostService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Http\Response;
use OCP\IRequest;
@ -410,14 +412,14 @@ class LocalController extends Controller {
* @param string $id
* @return DataResponse
*/
public function actorAvatar(string $id): DataResponse {
public function actorAvatar(string $id): Response {
try {
$actor = $this->personService->getFromId($id);
$avatar = $actor->getIcon();
$this->documentService->getFromCache($avatar->getId());
$document = $this->documentService->getFromCache($avatar->getId());
return $this->success(['actor' => $actor]);
return new FileDisplayResponse($document);
} catch (Exception $e) {
return $this->fail($e);
}

Wyświetl plik

@ -3,7 +3,7 @@
<div class="entry-content">
<div class="post-avatar">
<avatar v-if="item.actor_info" :size="32" :user="item.actor_info.preferredUsername" />
<avatar :size="32" user="?" />
<avatar :size="32" :url="avatarUrl" />
</div>
<div class="post-content">
<div class="post-author-wrapper">
@ -57,6 +57,9 @@ export default {
})
message = this.$twemoji.parse(message)
return message
},
avatarUrl: function() {
return OC.generateUrl('/apps/social/api/v1/actor/avatar?id=' + this.item.attributedTo)
}
}
}