From 4ce4b654ce3a2e6ef58c9661fd34063c9c4678cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ig=C3=B3n?= Date: Fri, 24 Nov 2023 11:27:30 +0100 Subject: [PATCH] fix bug on creating relation between project post and reward for privacy access --- .../Controller/Dashboard/ProjectDashboardController.php | 2 +- src/Goteo/Library/PostPrivacyAccess.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Goteo/Controller/Dashboard/ProjectDashboardController.php b/src/Goteo/Controller/Dashboard/ProjectDashboardController.php index 6621af8070..59467a612d 100644 --- a/src/Goteo/Controller/Dashboard/ProjectDashboardController.php +++ b/src/Goteo/Controller/Dashboard/ProjectDashboardController.php @@ -436,7 +436,7 @@ public function updatesPrivacyAction(Request $request, string $pid, string $uid) $post = BlogPost::getBySlug($uid); - $filters = ['post' => $post->id]; + $filters = ['post_id' => $post->id]; $total = PostRewardAccess::count($filters); $postRewardAccessList = PostRewardAccess::getList($filters, 0, $total); diff --git a/src/Goteo/Library/PostPrivacyAccess.php b/src/Goteo/Library/PostPrivacyAccess.php index c2eaa2be36..cb0632d34b 100644 --- a/src/Goteo/Library/PostPrivacyAccess.php +++ b/src/Goteo/Library/PostPrivacyAccess.php @@ -39,4 +39,13 @@ private function canUserAccess(User $user, Post $post): bool return false; } + + /** + * @return PostRewardAccess[] + */ + public function getLimitingRewardsForPost(Post $post): array + { + $postRewardsCount = PostRewardAccess::count(['post_id' => $post->id]); + return PostRewardAccess::getList(['post_id' => $post->id], 0, $postRewardsCount); + } }