added issue_notification

This commit is contained in:
hyung-hwan 2016-07-13 06:24:58 +00:00
parent 37b6afd896
commit 5527dd04b1
4 changed files with 26 additions and 2 deletions

View File

@ -296,6 +296,11 @@ commit_review_notification = "yes"
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
commit_notification_url = "" commit_notification_url = ""
;------------------------------------------------------------------------------
; Send notification upon new issue registration if yes
;------------------------------------------------------------------------------
issue_notification = "yes"
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; Codepot sets this revision property to assign a tag to a specific revision. ; Codepot sets this revision property to assign a tag to a specific revision.
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -266,6 +266,8 @@ class Issue extends Controller
//} //}
else else
{ {
$issue_url_base = $this->input->post('issue_url_base');
$issue = new stdClass(); $issue = new stdClass();
$issue->projectid = $projectid; $issue->projectid = $projectid;
$issue->summary = $this->input->post('issue_new_summary'); $issue->summary = $this->input->post('issue_new_summary');
@ -332,13 +334,28 @@ class Issue extends Controller
if ($status == '') if ($status == '')
{ {
if ($this->issues->createWithFiles ($login['id'], $issue, $attached_files, $this->upload) === FALSE) $issue_sno = $this->issues->createWithFiles ($login['id'], $issue, $attached_files, $this->upload);
if ($issue_sno === FALSE)
{ {
$status = 'error - ' . $this->issues->getErrorMessage(); $status = 'error - ' . $this->issues->getErrorMessage();
} }
else else
{ {
$status = 'ok'; $status = 'ok';
if (CODEPOT_ISSUE_NOTIFICATION)
{
// TODO: message localization
$email_subject = sprintf (
'New issue #%d for %s by %s in %s',
$issue_sno, $issue->owner, $login['id'], $projectid
);
$email_message = $issue_url_base . '/' . $this->converter->AsciiToHex((string)$issue_sno) . "\r\n" . $issue->summary;
$this->projects->emailMessageToMembers (
$projectid, $this->login, $email_subject, $email_message
);
}
} }
} }
} }

View File

@ -176,6 +176,7 @@ $(function () {
form_data.append ('issue_new_owner', $('#issue_home_new_owner').val()); form_data.append ('issue_new_owner', $('#issue_home_new_owner').val());
form_data.append ('issue_new_summary', $('#issue_home_new_summary').val()); form_data.append ('issue_new_summary', $('#issue_home_new_summary').val());
form_data.append ('issue_new_description', $('#issue_home_new_description').val()); form_data.append ('issue_new_description', $('#issue_home_new_description').val());
form_data.append ('issue_url_base', codepot_merge_path('<?php print site_url(); ?>', '<?php print "/issue/show/{$project->id}"; ?>'));
$('#issue_home_new_form').dialog('disable'); $('#issue_home_new_form').dialog('disable');
$.ajax({ $.ajax({

View File

@ -96,7 +96,8 @@ function load_ini ($file)
array ('email_sender', 'string', ''), array ('email_sender', 'string', ''),
array ('commit_notification', 'boolean', TRUE), array ('commit_notification', 'boolean', TRUE),
array ('commit_review_notification', 'boolean', TRUE), array ('commit_review_notification', 'boolean', TRUE),
array ('commit_notification_url', 'string', ''), array ('commit_notification_url', 'string', ''), // used by the svn post-commit script
array ('issue_notification', 'boolean', TRUE),
array ('svn_tag_property', 'string', 'codepot:tag'), array ('svn_tag_property', 'string', 'codepot:tag'),