Update AP Helpers, preserve admin unlisted state before adding to NetworkTimelineService

This commit is contained in:
Daniel Supernault 2023-07-14 01:20:26 -06:00
parent 9fa6b3f7aa
commit 0704c7e05e
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -466,12 +466,19 @@ class Helpers {
$scope = self::getScope($activity, $url); $scope = self::getScope($activity, $url);
$cw = self::getSensitive($activity, $url); $cw = self::getSensitive($activity, $url);
$pid = is_object($profile) ? $profile->id : (is_array($profile) ? $profile['id'] : null); $pid = is_object($profile) ? $profile->id : (is_array($profile) ? $profile['id'] : null);
$isUnlisted = is_object($profile) ? $profile->unlisted : (is_array($profile) ? $profile['unlisted'] : false);
$commentsDisabled = isset($activity['commentsEnabled']) ? !boolval($activity['commentsEnabled']) : false; $commentsDisabled = isset($activity['commentsEnabled']) ? !boolval($activity['commentsEnabled']) : false;
if(!$pid) { if(!$pid) {
return; return;
} }
if($scope == 'public') {
if($isUnlisted == true) {
$scope = 'unlisted';
}
}
$status = Status::updateOrCreate( $status = Status::updateOrCreate(
[ [
'uri' => $url 'uri' => $url
@ -519,9 +526,11 @@ class Helpers {
->values() ->values()
->toArray(); ->toArray();
if(!in_array($urlDomain, $filteredDomains)) { if(!in_array($urlDomain, $filteredDomains)) {
if(!$isUnlisted) {
NetworkTimelineService::add($status->id); NetworkTimelineService::add($status->id);
} }
} }
}
IncrementPostCount::dispatch($pid)->onQueue('low'); IncrementPostCount::dispatch($pid)->onQueue('low');