From 61d5b3e37b4dc6da4f7da48751b741ad49245cb1 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 1 Nov 2018 00:03:34 -0400 Subject: Update issue message submit buttons I'm going to be adding another button down here in the btn-group (more later). So to make room, I'm removing the text on these buttons, leaving only the icons. The text will instead be a tooltip, visible when the button is hovered. In the case of the 'Close issue' button, it is changed from btn-success to btn-default. I will tweak colors once this portion of the UI matures. For now, I don't want the rainbow in my face. Signed-off-by: Malf Furious --- app/view/issue.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/view/issue.php b/app/view/issue.php index 2d781ba..a0e2535 100644 --- a/app/view/issue.php +++ b/app/view/issue.php @@ -115,12 +115,12 @@ require_once "class/issue.class.php";
- -
-- cgit v1.2.3 From a6853e8a130cfe8f65a154a613f0a7217dd2df0a Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 1 Nov 2018 00:10:48 -0400 Subject: Add advance button to issue message form If this submit button is used, the message will be posted as usual, then the issue will be moved to the next stage in the pipeline. Signed-off-by: Malf Furious --- app/view/issue.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/view/issue.php b/app/view/issue.php index a0e2535..67f5627 100644 --- a/app/view/issue.php +++ b/app/view/issue.php @@ -122,6 +122,10 @@ require_once "class/issue.class.php"; + + -- cgit v1.2.3 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(-) 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(+) 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(-) 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