Browse Source

Merge pull request #3673 from pixelfed/staging

Update ap helpers to handle disabled comments
daniel 2 years ago
parent
commit
1d1091d583
2 changed files with 4 additions and 1 deletions
  1. 1 0
      CHANGELOG.md
  2. 3 1
      app/Util/ActivityPub/Helpers.php

+ 1 - 0
CHANGELOG.md

@@ -88,6 +88,7 @@
 - Update StatusObserver, handle events after all transactions are committed ([805a014e](https://github.com/pixelfed/pixelfed/commit/805a014e))
 - Update ApiV1Controller, add collection_ids parameter to /api/v1/statuses endpoint ([7ae21fc3](https://github.com/pixelfed/pixelfed/commit/7ae21fc3))
 - Update ApiV1Controller, add comments_disabled param to /api/v1/statuses endpoint ([95b58610](https://github.com/pixelfed/pixelfed/commit/95b58610))
+- Update ap helpers to handle disabled comments ([92f56c9b](https://github.com/pixelfed/pixelfed/commit/92f56c9b))
 -  ([](https://github.com/pixelfed/pixelfed/commit/))
 
 ## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)

+ 3 - 1
app/Util/ActivityPub/Helpers.php

@@ -469,6 +469,7 @@ class Helpers {
 			$scope = self::getScope($activity, $url);
 			$cw = self::getSensitive($activity, $url);
 			$pid = is_object($profile) ? $profile->id : (is_array($profile) ? $profile['id'] : null);
+            $commentsDisabled = isset($activity['commentsEnabled']) ? !boolval($activity['commentsEnabled']) : false;
 
 			if(!$pid) {
 				return;
@@ -490,7 +491,8 @@ class Helpers {
                     'scope' => $scope,
                     'visibility' => $scope,
                     'cw_summary' => ($cw == true && isset($activity['summary']) ?
-                        Purify::clean(strip_tags($activity['summary'])) : null)
+                        Purify::clean(strip_tags($activity['summary'])) : null),
+                    'comments_disabled' => $commentsDisabled
                 ]
             );