Skip to content

Commit b7134f3

Browse files
committed
Allow validator to choose who they approve/deny as
fix
1 parent d324eae commit b7134f3

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

controller/manage/queue/item.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,11 @@ protected function move()
390390
public function approve()
391391
{
392392
$public_notes = $this->request->variable('public_notes', '', true);
393+
$post_as_robot = $this->request->variable('post_as_robot', 1);
393394

394395
if ($this->validate('approve'))
395396
{
396-
$robot_user_id = $this->contrib->type->forum_robot;
397+
$robot_user_id = $post_as_robot ? $this->contrib->type->forum_robot : 0;
397398
$this->queue->approve($public_notes, $robot_user_id);
398399

399400
// Reload contribution with new data.
@@ -432,9 +433,11 @@ public function approve()
432433
*/
433434
public function deny()
434435
{
436+
$post_as_robot = $this->request->variable('post_as_robot', 1);
437+
435438
if ($this->validate('deny'))
436439
{
437-
$robot_user_id = $this->contrib->type->forum_robot;
440+
$robot_user_id = $post_as_robot ? $this->contrib->type->forum_robot : 0;
438441
$this->queue->deny($robot_user_id);
439442
$this->contrib->type->deny($this->contrib, $this->queue, $this->request);
440443
redirect($this->queue->get_url());
@@ -476,12 +479,19 @@ protected function validate($action)
476479
$this->contrib->type->display_validation_options($action, $this->request, $this->template);
477480
$this->display_topic_review();
478481

482+
$post_as_robot = $this->request->variable('post_as_robot', 1);
483+
$has_robot = !empty($this->contrib->type->forum_robot);
484+
479485
$this->template->assign_vars(array(
480486
'ERROR' => implode('<br />', $error),
481487
'L_TOPIC_REVIEW' => $this->user->lang['QUEUE_REVIEW'],
482488
'TOPIC_TITLE' => $this->contrib->contrib_name,
483489
'PAGE_TITLE_EXPLAIN' => $this->user->lang[strtoupper($action) . '_QUEUE_CONFIRM'],
484490
'S_CONFIRM_ACTION' => $this->queue->get_url($action),
491+
'S_SHOW_POST_AS_OPTION' => $has_robot,
492+
'POST_AS_ROBOT' => $post_as_robot,
493+
'POST_AS_LABEL' => $this->user->lang['POST_AS_' . strtoupper($action)],
494+
'ROBOT_NAME' => ucfirst($this->contrib->type->name),
485495
));
486496

487497
return false;

language/en/manage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
'OPEN_ITEMS' => 'Open Items',
8585

8686
'PLEASE_WAIT_FOR_TOOL' => 'Please wait for the tool to finish running.',
87+
'POST_AS_APPROVE' => 'Approve as',
88+
'POST_AS_DENY' => 'Deny as',
89+
'POST_AS_ROBOT' => '%s Robot',
90+
'POST_AS_SELF' => 'Yourself',
8791
'PUBLIC_NOTES' => 'Public release notes',
8892

8993
'QUEUE_APPROVE' => 'Awaiting Approval',

styles/prosilver/template/manage/queue_validate.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ <h3>{{ lang('PREVIEW') ~ lang('COLON') }} {{ PUBLIC_PREVIEW_SUBJECT }}</h3>
2626
<h2>{{ PAGE_TITLE }}</h2>
2727
<p>{{ PAGE_TITLE_EXPLAIN }}</p>
2828

29+
{% if S_SHOW_POST_AS_OPTION %}
30+
<fieldset>
31+
<dl>
32+
<dt><label>{{ POST_AS_LABEL ~ lang('COLON') }}</label></dt>
33+
<dd>
34+
<label><input type="radio" name="post_as_robot" value="1"{% if POST_AS_ROBOT %} checked="checked"{% endif %} /> {{ lang('POST_AS_ROBOT', ROBOT_NAME) }}</label>
35+
<label><input type="radio" name="post_as_robot" value="0"{% if not POST_AS_ROBOT %} checked="checked"{% endif %} /> {{ lang('POST_AS_SELF') }}</label>
36+
</dd>
37+
</dl>
38+
</fieldset>
39+
{% endif %}
40+
2941
<fieldset>
3042
{% if S_STYLE_DEMO_INSTALL %}
3143
<dl>

0 commit comments

Comments
 (0)