sforkowany z mirror/social
Use avatar endpoint if no actor_info is available
Signed-off-by: Julius Härtl <jus@bitgrid.net>alpha1
rodzic
5627236d32
commit
53b5cc29e7
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue