From bdea799766aaf9a4a5124ac703058c9648ff2819 Mon Sep 17 00:00:00 2001 From: jellykells <42573508+jellykells@users.noreply.github.com> Date: Thu, 23 Dec 2021 21:45:44 -0600 Subject: [PATCH 1/3] allow image owner to view their unapproved images --- ext/approval/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/approval/main.php b/ext/approval/main.php index df58429a..fbf836df 100644 --- a/ext/approval/main.php +++ b/ext/approval/main.php @@ -191,7 +191,7 @@ class Approval extends Extension { global $user, $config; - if ($config->get_bool(ApprovalConfig::IMAGES) && $image->approved===false && !$user->can(Permissions::APPROVE_IMAGE)) { + if ($config->get_bool(ApprovalConfig::IMAGES) && $image->approved===false && !$user->can(Permissions::APPROVE_IMAGE) && $user->id!==$image->owner_id) { return false; } return true; From 29ed277f6d0d7320b773d7d7b808836e4e49ebe3 Mon Sep 17 00:00:00 2001 From: jellykells <42573508+jellykells@users.noreply.github.com> Date: Thu, 23 Dec 2021 21:58:55 -0600 Subject: [PATCH 2/3] hide comments made on unapproved images from the comment list --- ext/comment/main.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/comment/main.php b/ext/comment/main.php index da1c65f1..8efe4b72 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -275,6 +275,12 @@ class CommentList extends Extension ) { $image = null; // this is "clever", I may live to regret it } + if ( + Extension::is_enabled(ApprovalInfo::KEY) && !is_null($image) && + $image->approved!==true + ) { + $image = null; + } if (!is_null($image)) { $comments = $this->get_comments($image->id); $images[] = [$image, $comments]; From a0190bff8194f0f29b77c2cd88988d13539e43ac Mon Sep 17 00:00:00 2001 From: jellykells <42573508+jellykells@users.noreply.github.com> Date: Thu, 23 Dec 2021 22:18:33 -0600 Subject: [PATCH 3/3] run php cs fixer --- ext/comment/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/comment/main.php b/ext/comment/main.php index 8efe4b72..916fc38b 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -279,7 +279,7 @@ class CommentList extends Extension Extension::is_enabled(ApprovalInfo::KEY) && !is_null($image) && $image->approved!==true ) { - $image = null; + $image = null; } if (!is_null($image)) { $comments = $this->get_comments($image->id);