From d324eaed45f7df5552770a180cb7b9c0623fb9a8 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 22 Feb 2026 16:31:46 -0800 Subject: [PATCH 1/4] Post approved/denied exts/styles with robot user Revert --- controller/manage/queue/item.php | 6 +++-- includes/objects/queue.php | 43 +++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/controller/manage/queue/item.php b/controller/manage/queue/item.php index f567959b3..df79c0cf0 100644 --- a/controller/manage/queue/item.php +++ b/controller/manage/queue/item.php @@ -393,7 +393,8 @@ public function approve() if ($this->validate('approve')) { - $this->queue->approve($public_notes); + $robot_user_id = $this->contrib->type->forum_robot; + $this->queue->approve($public_notes, $robot_user_id); // Reload contribution with new data. $this->contrib->load(); @@ -433,7 +434,8 @@ public function deny() { if ($this->validate('deny')) { - $this->queue->deny(); + $robot_user_id = $this->contrib->type->forum_robot; + $this->queue->deny($robot_user_id); $this->contrib->type->deny($this->contrib, $this->queue, $this->request); redirect($this->queue->get_url()); } diff --git a/includes/objects/queue.php b/includes/objects/queue.php index 89241ea22..daf7d07e9 100644 --- a/includes/objects/queue.php +++ b/includes/objects/queue.php @@ -230,9 +230,10 @@ public function update_first_queue_post($post_subject = false) * * @param string $message * @param bool $teams_only true to set to access level of teams + * @param int $post_user_id User ID to use for the post (defaults to current user) * @return \titania_post Returns post object. */ - public function topic_reply($message, $teams_only = true) + public function topic_reply($message, $teams_only = true, $post_user_id = 0) { $this->user->add_lang_ext('phpbb/titania', 'manage'); @@ -249,6 +250,11 @@ public function topic_reply($message, $teams_only = true) $post->post_access = access::TEAM_LEVEL; } + if ($post_user_id) + { + $post->post_user_id = (int) $post_user_id; + } + $post->parent_contrib_type = $this->queue_type; $post->generate_text_for_storage(true, true, true); @@ -384,8 +390,9 @@ public function change_tested_mark($mark) * Approve this revision * * @param mixed $public_notes + * @param int $robot_user_id User ID to use for posts/messages (defaults to current user) */ - public function approve($public_notes) + public function approve($public_notes, $robot_user_id = 0) { $this->user->add_lang_ext('phpbb/titania', array('manage', 'contributions')); $revision = $this->get_revision(); @@ -407,8 +414,8 @@ public function approve($public_notes) $message = str_replace('[quote][/quote]', '', $message); } - $this->topic_reply($message, false); - $this->discussion_reply($message); + $this->topic_reply($message, false, $robot_user_id); + $this->discussion_reply($message, false, $robot_user_id); // Get branch information first $version_branches = array(); @@ -430,13 +437,13 @@ public function approve($public_notes) { // Replying to an already existing topic, use the update message $post_public_notes = sprintf(phpbb::$user->lang[$contrib->type->update_public], $revision->revision_version) . (($public_notes) ? sprintf(phpbb::$user->lang[$contrib->type->update_public . '_NOTES'], $public_notes) : ''); - $contrib->reply_release_topic($branch, $post_public_notes); + $contrib->reply_release_topic($branch, $post_public_notes, array('poster_id' => $robot_user_id)); } elseif (!$contrib_release_topic_id && $contrib->type->reply_public) { // Replying to a topic that was just made, use the reply message $post_public_notes = phpbb::$user->lang[$contrib->type->reply_public] . (($public_notes) ? sprintf(phpbb::$user->lang[$contrib->type->reply_public . '_NOTES'], $public_notes) : ''); - $contrib->reply_release_topic($branch, $post_public_notes); + $contrib->reply_release_topic($branch, $post_public_notes, array('poster_id' => $robot_user_id)); } } @@ -447,7 +454,7 @@ public function approve($public_notes) $this->submit(false); // Send notification message - $this->send_approve_deny_notification(true); + $this->send_approve_deny_notification(true, $robot_user_id); // Subscriptions $email_vars = array( @@ -474,7 +481,7 @@ public function close($revision_status) $this->trash_queue_topic(); } - public function deny() + public function deny($robot_user_id = 0) { // Reply to the queue topic and discussion with the message $this->user->add_lang_ext('phpbb/titania', 'manage'); @@ -490,8 +497,8 @@ public function deny() $message = str_replace('[quote][/quote]', '', $message); } - $this->topic_reply($message, false); - $this->discussion_reply($message); + $this->topic_reply($message, false, $robot_user_id); + $this->discussion_reply($message, false, $robot_user_id); // Update the revision $revision->change_status(ext::TITANIA_REVISION_DENIED); @@ -503,15 +510,17 @@ public function deny() $this->submit(false); // Send notification message - $this->send_approve_deny_notification(false); + $this->send_approve_deny_notification(false, $robot_user_id); $this->trash_queue_topic(); } /** * Send the approve/deny notification + * @param bool $approve + * @param int $robot_user_id User ID to use as sender (defaults to current user) */ - private function send_approve_deny_notification($approve = true) + private function send_approve_deny_notification($approve = true, $robot_user_id = 0) { $this->user->add_lang_ext('phpbb/titania', 'manage'); phpbb::_include('functions_privmsgs', 'submit_pm'); @@ -560,12 +569,16 @@ private function send_approve_deny_notification($approve = true) $message_uid = $message_bitfield = $message_options = false; generate_text_for_storage($message, $message_uid, $message_bitfield, $message_options, true, true, true); + $sender_id = $robot_user_id ?: phpbb::$user->data['user_id']; + $sender_name = users_overlord::get_user($sender_id, 'username', true); + $sender_ip = $robot_user_id ? '' : phpbb::$user->ip; + $data = array( 'address_list' => array('u' => $authors), - 'from_user_id' => phpbb::$user->data['user_id'], - 'from_username' => phpbb::$user->data['username'], + 'from_user_id' => $sender_id, + 'from_username' => $sender_name, 'icon_id' => 0, - 'from_user_ip' => phpbb::$user->ip, + 'from_user_ip' => $sender_ip, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, From b7134f3d3ea21bf1aaf32b487bcc1acc1baf547c Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 22 Feb 2026 16:43:02 -0800 Subject: [PATCH 2/4] Allow validator to choose who they approve/deny as fix --- controller/manage/queue/item.php | 14 ++++++++++++-- language/en/manage.php | 4 ++++ .../prosilver/template/manage/queue_validate.html | 12 ++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/controller/manage/queue/item.php b/controller/manage/queue/item.php index df79c0cf0..f3d9669f4 100644 --- a/controller/manage/queue/item.php +++ b/controller/manage/queue/item.php @@ -390,10 +390,11 @@ protected function move() public function approve() { $public_notes = $this->request->variable('public_notes', '', true); + $post_as_robot = $this->request->variable('post_as_robot', 1); if ($this->validate('approve')) { - $robot_user_id = $this->contrib->type->forum_robot; + $robot_user_id = $post_as_robot ? $this->contrib->type->forum_robot : 0; $this->queue->approve($public_notes, $robot_user_id); // Reload contribution with new data. @@ -432,9 +433,11 @@ public function approve() */ public function deny() { + $post_as_robot = $this->request->variable('post_as_robot', 1); + if ($this->validate('deny')) { - $robot_user_id = $this->contrib->type->forum_robot; + $robot_user_id = $post_as_robot ? $this->contrib->type->forum_robot : 0; $this->queue->deny($robot_user_id); $this->contrib->type->deny($this->contrib, $this->queue, $this->request); redirect($this->queue->get_url()); @@ -476,12 +479,19 @@ protected function validate($action) $this->contrib->type->display_validation_options($action, $this->request, $this->template); $this->display_topic_review(); + $post_as_robot = $this->request->variable('post_as_robot', 1); + $has_robot = !empty($this->contrib->type->forum_robot); + $this->template->assign_vars(array( 'ERROR' => implode('
', $error), 'L_TOPIC_REVIEW' => $this->user->lang['QUEUE_REVIEW'], 'TOPIC_TITLE' => $this->contrib->contrib_name, 'PAGE_TITLE_EXPLAIN' => $this->user->lang[strtoupper($action) . '_QUEUE_CONFIRM'], 'S_CONFIRM_ACTION' => $this->queue->get_url($action), + 'S_SHOW_POST_AS_OPTION' => $has_robot, + 'POST_AS_ROBOT' => $post_as_robot, + 'POST_AS_LABEL' => $this->user->lang['POST_AS_' . strtoupper($action)], + 'ROBOT_NAME' => ucfirst($this->contrib->type->name), )); return false; diff --git a/language/en/manage.php b/language/en/manage.php index 7e83d4309..bcbae76d0 100644 --- a/language/en/manage.php +++ b/language/en/manage.php @@ -84,6 +84,10 @@ 'OPEN_ITEMS' => 'Open Items', 'PLEASE_WAIT_FOR_TOOL' => 'Please wait for the tool to finish running.', + 'POST_AS_APPROVE' => 'Approve as', + 'POST_AS_DENY' => 'Deny as', + 'POST_AS_ROBOT' => '%s Robot', + 'POST_AS_SELF' => 'Yourself', 'PUBLIC_NOTES' => 'Public release notes', 'QUEUE_APPROVE' => 'Awaiting Approval', diff --git a/styles/prosilver/template/manage/queue_validate.html b/styles/prosilver/template/manage/queue_validate.html index d9b21959b..671ce9e37 100644 --- a/styles/prosilver/template/manage/queue_validate.html +++ b/styles/prosilver/template/manage/queue_validate.html @@ -26,6 +26,18 @@

{{ lang('PREVIEW') ~ lang('COLON') }} {{ PUBLIC_PREVIEW_SUBJECT }}

{{ PAGE_TITLE }}

{{ PAGE_TITLE_EXPLAIN }}

+ {% if S_SHOW_POST_AS_OPTION %} +
+
+
+
+ + +
+
+
+ {% endif %} +
{% if S_STYLE_DEMO_INSTALL %}
From 8682ef1b78c9b85c8b10684009962d9456658bbc Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 22 Feb 2026 18:00:05 -0800 Subject: [PATCH 3/4] Styling hacks --- styles/prosilver/template/manage/queue_validate.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/styles/prosilver/template/manage/queue_validate.html b/styles/prosilver/template/manage/queue_validate.html index 671ce9e37..c75021524 100644 --- a/styles/prosilver/template/manage/queue_validate.html +++ b/styles/prosilver/template/manage/queue_validate.html @@ -29,10 +29,10 @@

{{ PAGE_TITLE }}

{% if S_SHOW_POST_AS_OPTION %}
-
-
- - +
+
+ +
From c51d94a9e867ce8727f4b9043bc947adfa45042b Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Mon, 23 Feb 2026 08:02:27 -0800 Subject: [PATCH 4/4] Correctly get the name of the validation bots --- controller/manage/queue/item.php | 5 +++-- language/en/manage.php | 1 - styles/prosilver/template/manage/queue_validate.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controller/manage/queue/item.php b/controller/manage/queue/item.php index f3d9669f4..6dbf31615 100644 --- a/controller/manage/queue/item.php +++ b/controller/manage/queue/item.php @@ -481,6 +481,7 @@ protected function validate($action) $post_as_robot = $this->request->variable('post_as_robot', 1); $has_robot = !empty($this->contrib->type->forum_robot); + $robot_name = $has_robot ? \users_overlord::get_user($this->contrib->type->forum_robot, 'username', true) : ''; $this->template->assign_vars(array( 'ERROR' => implode('
', $error), @@ -488,10 +489,10 @@ protected function validate($action) 'TOPIC_TITLE' => $this->contrib->contrib_name, 'PAGE_TITLE_EXPLAIN' => $this->user->lang[strtoupper($action) . '_QUEUE_CONFIRM'], 'S_CONFIRM_ACTION' => $this->queue->get_url($action), - 'S_SHOW_POST_AS_OPTION' => $has_robot, + 'S_SHOW_POST_AS_OPTION' => $has_robot && $robot_name, 'POST_AS_ROBOT' => $post_as_robot, + 'ROBOT_NAME' => $robot_name, 'POST_AS_LABEL' => $this->user->lang['POST_AS_' . strtoupper($action)], - 'ROBOT_NAME' => ucfirst($this->contrib->type->name), )); return false; diff --git a/language/en/manage.php b/language/en/manage.php index bcbae76d0..9eec1e0cd 100644 --- a/language/en/manage.php +++ b/language/en/manage.php @@ -86,7 +86,6 @@ 'PLEASE_WAIT_FOR_TOOL' => 'Please wait for the tool to finish running.', 'POST_AS_APPROVE' => 'Approve as', 'POST_AS_DENY' => 'Deny as', - 'POST_AS_ROBOT' => '%s Robot', 'POST_AS_SELF' => 'Yourself', 'PUBLIC_NOTES' => 'Public release notes', diff --git a/styles/prosilver/template/manage/queue_validate.html b/styles/prosilver/template/manage/queue_validate.html index c75021524..78af05e8d 100644 --- a/styles/prosilver/template/manage/queue_validate.html +++ b/styles/prosilver/template/manage/queue_validate.html @@ -31,7 +31,7 @@

{{ PAGE_TITLE }}

- +