From 4dfa82a45e7704ddb31f7030721436cae0151679 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 18 Jun 2020 10:48:45 +0000 Subject: [PATCH 1/4] Update Dependabot config file --- .dependabot/config.yml | 31 ------------------------------- .github/dependabot.yml | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 31 deletions(-) delete mode 100644 .dependabot/config.yml create mode 100644 .github/dependabot.yml diff --git a/.dependabot/config.yml b/.dependabot/config.yml deleted file mode 100644 index 7fd3c76df..000000000 --- a/.dependabot/config.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: 1 - -update_configs: - - package_manager: "php:composer" - directory: "/" - update_schedule: "daily" - # Supported update schedule: live daily weekly monthly - target_branch: "staging" - version_requirement_updates: "auto" - # Supported version requirements: auto widen_ranges increase_versions increase_versions_if_necessary - allowed_updates: - - match: - dependency_type: "all" - # Supported dependency types: all indirect direct production development - update_type: "all" - # Supported update types: all security - - - package_manager: "javascript" - directory: "/" - update_schedule: "daily" - # Supported update schedule: live daily weekly monthly - target_branch: "staging" - version_requirement_updates: "auto" - # Supported version requirements: auto widen_ranges increase_versions increase_versions_if_necessary - allowed_updates: - - match: - dependency_type: "all" - # Supported dependency types: all indirect direct production development - update_type: "all" - # Supported update types: all security - diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..e924cb855 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +version: 2 +updates: +- package-ecosystem: composer + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 99 + target-branch: staging + allow: + - dependency-type: all +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 99 + target-branch: staging + allow: + - dependency-type: all From a0bde855bdbca0b0a927468e8e994b792054ad65 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 18 Jun 2020 21:03:35 -0600 Subject: [PATCH 2/4] Update ApiV1Controller, add status ancestor and descendant context --- app/Http/Controllers/Api/ApiV1Controller.php | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 17d6fc269..4bc055ed8 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1525,11 +1525,27 @@ class ApiV1Controller extends Controller } } - // Return empty response since we don't handle threading like this - $res = [ - 'ancestors' => [], - 'descendants' => [] - ]; + if($status->comments_disabled) { + $res = [ + 'ancestors' => [], + 'descendants' => [] + ]; + } else { + $ancestors = $status->parent(); + if($ancestors) { + $ares = new Fractal\Resource\Item($ancestors, new StatusTransformer()); + $ancestors = $this->fractal->createData($ares)->toArray(); + } else { + $ancestors = []; + } + $descendants = Status::whereInReplyToId($id)->latest()->limit(20)->get(); + $dres = new Fractal\Resource\Collection($descendants, new StatusTransformer()); + $descendants = $this->fractal->createData($dres)->toArray(); + $res = [ + 'ancestors' => $ancestors, + 'descendants' => $descendants + ]; + } return response()->json($res); } From 6dd83d32e3ddf9cc20e66a05843d0a22bdf0a191 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 18 Jun 2020 21:04:20 -0600 Subject: [PATCH 3/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf5637584..e07499599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ - Updated AP Helpers, update bio + name ([4bee8397](https://github.com/pixelfed/pixelfed/commit/4bee8397)) - Updated Profile component, add bookmark loader ([c8d5edc9](https://github.com/pixelfed/pixelfed/commit/c8d5edc9)) - Updated PostComponent, add recent posts ([b289f2f6](https://github.com/pixelfed/pixelfed/commit/b289f2f6)) +- Updated ApiV1Controller, add status ancestor and descendant context ([a0bde855](https://github.com/pixelfed/pixelfed/commit/a0bde855)) ## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9) From 00a96a15f0179b8f581deef45450c284e9d566f3 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 18 Jun 2020 21:08:13 -0600 Subject: [PATCH 4/4] Update ApiV1Controller, wrap ancestor in array --- app/Http/Controllers/Api/ApiV1Controller.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 4bc055ed8..edf89261c 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1534,7 +1534,9 @@ class ApiV1Controller extends Controller $ancestors = $status->parent(); if($ancestors) { $ares = new Fractal\Resource\Item($ancestors, new StatusTransformer()); - $ancestors = $this->fractal->createData($ares)->toArray(); + $ancestors = [ + $this->fractal->createData($ares)->toArray() + ]; } else { $ancestors = []; }