diff options
author | Malf Furious <m@lfurio.us> | 2018-11-01 04:27:05 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2018-11-01 04:27:05 -0400 |
commit | 75c8a6d4ee00ba9b7040697c4de65620f27b9728 (patch) | |
tree | 8d23a5f03c6c416d460e693ac013261e042500dd | |
parent | a6853e8a130cfe8f65a154a613f0a7217dd2df0a (diff) | |
download | scrott-75c8a6d4ee00ba9b7040697c4de65620f27b9728.tar.gz scrott-75c8a6d4ee00ba9b7040697c4de65620f27b9728.zip |
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 <m@lfurio.us>
-rw-r--r-- | app/model/issue.php | 19 |
1 files 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'])) { |