From 75c8a6d4ee00ba9b7040697c4de65620f27b9728 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 1 Nov 2018 04:27:05 -0400 Subject: Make issue reply message optional The 'iss-mesg-add' form will now allow a mesg to be omitted, since it will also be handling other events. These events are part of the same form since the UI allows users to post a message and trigger these other actions at the same time. We now only create a mesg object if a mesg is given. Note that an attachment requires a message. IE: any attachment is ignored if no message is created. Signed-off-by: Malf Furious --- app/model/issue.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'app/model') diff --git a/app/model/issue.php b/app/model/issue.php index 4300bbb..0954ad9 100644 --- a/app/model/issue.php +++ b/app/model/issue.php @@ -23,7 +23,7 @@ if (isAction("iss-mesg-add")) { $form = new form(); $form->text("issue"); - $form->text("mesg"); + $form->text("mesg", false); if (!$form->populate(input())) return; @@ -36,16 +36,19 @@ if (isAction("iss-mesg-add")) return; } - if (!$user->canCreateSub($issue)) + if (isset($form->mesg) && $form->mesg != "") { - logError(ERROR, "You do not have permission to post to this issue"); - return; - } + if (!$user->canCreateSub($issue)) + { + logError(ERROR, "You do not have permission to post to this issue"); + return; + } - $mesg = mesg::initNew($form->mesg, $user, $issue); + $mesg = mesg::initNew($form->mesg, $user, $issue); - if ($mesg->setAttachment("attachment")) - logError(NOTICE, "Saved attachment " . $mesg->attachment); + if ($mesg->setAttachment("attachment")) + logError(NOTICE, "Saved attachment " . $mesg->attachment); + } if (isset(input()['closeIssue'])) { -- cgit v1.2.3 From d8e6fc09df73e4165fa5503b713f8958e1599175 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 1 Nov 2018 04:35:26 -0400 Subject: Fix 'closeIssue' form submission I was failing to assert user has modify permissions for the issue. Signed-off-by: Malf Furious --- app/model/issue.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/model') diff --git a/app/model/issue.php b/app/model/issue.php index 0954ad9..403e82e 100644 --- a/app/model/issue.php +++ b/app/model/issue.php @@ -52,6 +52,12 @@ if (isAction("iss-mesg-add")) if (isset(input()['closeIssue'])) { + if (!$user->canModify($issue)) + { + logError(ERROR, "You do not have permission to close this issue"); + return; + } + $issue->close($user); logError(NOTICE, "Issue #" . $issue->numb . " closed"); $log = mesg::initNewLog("% closed issue", $user, $issue); -- cgit v1.2.3 From dc99ab0c0a0603d5efc1e07cf690c53260528820 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 1 Nov 2018 04:43:55 -0400 Subject: Implement iss-mesg-add 'advIssue' submission Handler now includes logic for optionally advancing the issue through the pipeline. If this happens, 'closeIssue' (for example) will not be checked, as only one submission can be used. Signed-off-by: Malf Furious --- app/model/issue.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'app/model') diff --git a/app/model/issue.php b/app/model/issue.php index 403e82e..910cb14 100644 --- a/app/model/issue.php +++ b/app/model/issue.php @@ -50,7 +50,28 @@ if (isAction("iss-mesg-add")) logError(NOTICE, "Saved attachment " . $mesg->attachment); } - if (isset(input()['closeIssue'])) + if (isset(input()['advIssue'])) + { + if (!$user->canModify($issue)) + { + logError(ERROR, "You do not have permission to move this issue"); + return; + } + + $issue->advance($user); + + if ($issue->isOpen()) + { + $sgename = $issue->getParent()->name; + $log = mesg::initNewLog("%s advanced issue to '" . $sgename . "'", $user, $issue); + } + else + { + $log = mesg::initNewLog("%s closed issue", $user, $issue); + } + } + + else if (isset(input()['closeIssue'])) { if (!$user->canModify($issue)) { -- cgit v1.2.3 From 2fc9cff6006580e3b1d9e3f194de3ef29e5d0247 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 4 Nov 2018 16:49:17 -0500 Subject: Implement 'add assignee' form handler The 'iss-mesg-add' form now handles when the 'assIssue' submission is sent. This is the only submission of this form that looks at the (usually hidden) 'assignee' dropdown field, which has been made a required field however. Signed-off-by: Malf Furious --- app/model/issue.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'app/model') diff --git a/app/model/issue.php b/app/model/issue.php index 910cb14..923bfc2 100644 --- a/app/model/issue.php +++ b/app/model/issue.php @@ -24,6 +24,7 @@ if (isAction("iss-mesg-add")) $form = new form(); $form->text("issue"); $form->text("mesg", false); + $form->text("assignee"); if (!$form->populate(input())) return; @@ -71,6 +72,23 @@ if (isAction("iss-mesg-add")) } } + else if (isset(input()['assIssue'])) + { + if (!$user->canModify($issue)) + { + logError(ERROR, "You do not have permission to assign this issue"); + return; + } + + $assignee = new user($form->assignee); + $stat = $issue->addAssignee($assignee, $user); + + if (!$stat) + logError(ERROR, "Failed to assign issue"); + else + $log = mesg::initNewLog("%s assigned " . $assignee->getDisplayName(), $user, $issue); + } + else if (isset(input()['closeIssue'])) { if (!$user->canModify($issue)) -- cgit v1.2.3 From fead9f76a6f620642e0051d0065e689580af7d90 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Mon, 5 Nov 2018 02:56:36 -0500 Subject: Fix bug in 'iss-mesg-add' form handler When closing issues, we were using a malformed format string. The 's' from the '%s' was missing. Signed-off-by: Malf Furious --- app/model/issue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/model') diff --git a/app/model/issue.php b/app/model/issue.php index 923bfc2..7159015 100644 --- a/app/model/issue.php +++ b/app/model/issue.php @@ -99,7 +99,7 @@ if (isAction("iss-mesg-add")) $issue->close($user); logError(NOTICE, "Issue #" . $issue->numb . " closed"); - $log = mesg::initNewLog("% closed issue", $user, $issue); + $log = mesg::initNewLog("%s closed issue", $user, $issue); } } -- cgit v1.2.3 From 434ebff8466ead8f9bb4c0f00037a107cbf842c4 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Mon, 5 Nov 2018 03:32:06 -0500 Subject: Add pad closed issues view This view is routable from app//closed. It is a separate view for displaying the closed issues of a pad. index.php as well as the pad model code is also updated to support this view. This view currently *does not* support paging. This will very likely be added in the future. Signed-off-by: Malf Furious --- app/model/pad.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/model') diff --git a/app/model/pad.php b/app/model/pad.php index d7cfb23..0090c27 100644 --- a/app/model/pad.php +++ b/app/model/pad.php @@ -26,4 +26,6 @@ foreach ($stages as $s) $issues = array_merge($issues, $i); } +$closed_issues = $pad->getClosedIssues_ordByClosed(); + ?> -- cgit v1.2.3