kopia lustrzana https://github.com/nextcloud/social
set reblogged and favorited in mastadon api
Signed-off-by: Robin Appelman <robin@icewind.nl>pull/1090/head
rodzic
cd86386bff
commit
dd9ed2f972
|
@ -480,6 +480,21 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
|
|||
* @return array
|
||||
*/
|
||||
public function exportAsLocal(): array {
|
||||
$actions = ($this->hasAction()) ? $this->getAction()->getValues() : [];
|
||||
$favorited = false;
|
||||
$reblogged = false;
|
||||
foreach ($actions as $action => $value) {
|
||||
if ($value) {
|
||||
switch ($action) {
|
||||
case StreamAction::BOOSTED:
|
||||
$reblogged = true;
|
||||
break;
|
||||
case StreamAction::LIKED:
|
||||
$favorited = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = [
|
||||
"content" => $this->getContent(),
|
||||
"sensitive" => $this->isSensitive(),
|
||||
|
@ -491,8 +506,8 @@ class Stream extends ACore implements IQueryRow, JsonSerializable {
|
|||
'replies_count' => 0,
|
||||
'reblogs_count' => 0,
|
||||
'favourites_count' => 0,
|
||||
'favourited' => false,
|
||||
'reblogged' => false,
|
||||
'favourited' => $favorited,
|
||||
'reblogged' => $reblogged,
|
||||
'muted' => false,
|
||||
'bookmarked' => false,
|
||||
'uri' => $this->getId(),
|
||||
|
|
Ładowanie…
Reference in New Issue