1
0
Fork 0
forked from mirror/pixelfed

Update Status Model

This commit is contained in:
Daniel Supernault 2018-11-13 17:28:45 -07:00
parent 6f3695e6de
commit 7691da69a9
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -113,7 +113,7 @@ class Status extends Model
public function bookmarked() public function bookmarked()
{ {
if (!Auth::check()) { if (!Auth::check()) {
return 0; return false;
} }
$profile = Auth::user()->profile; $profile = Auth::user()->profile;
@ -139,7 +139,7 @@ class Status extends Model
{ {
$parent = $this->in_reply_to_id ?? $this->reblog_of_id; $parent = $this->in_reply_to_id ?? $this->reblog_of_id;
if (!empty($parent)) { if (!empty($parent)) {
return self::findOrFail($parent); return $this->findOrFail($parent);
} }
} }
@ -254,7 +254,7 @@ class Status extends Model
'url' => $media->url(), 'url' => $media->url(),
'name' => null 'name' => null
]; ];
}) })->toArray()
] ]
]; ];
} }
@ -268,14 +268,16 @@ class Status extends Model
$res['to'] = []; $res['to'] = [];
$res['cc'] = []; $res['cc'] = [];
$scope = $this->scope; $scope = $this->scope;
$mentions = $this->mentions->map(function ($mention) {
return $mention->permalink();
})->toArray();
switch ($scope) { switch ($scope) {
case 'public': case 'public':
$res['to'] = [ $res['to'] = [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
]; ];
$res['cc'] = [ $res['cc'] = array_merge([$this->profile->permalink('/followers')], $mentions);
$this->profile->permalink('/followers')
];
break; break;
default: default: