Fix to an issue with proposal notifications and tightening of the gpg diagnostics

- Proposal alerts would be generated even if a deleted proposal got synced from a remote instance

- One of the GPG diagnostic checks could run if a previous prerequisite has already failed
pull/1050/head
Iglocska 2016-03-04 09:40:45 +01:00
parent cb5a14c3e1
commit bd2f9572b7
2 changed files with 14 additions and 8 deletions

View File

@ -410,8 +410,10 @@ class ShadowAttributesController extends AppController {
if ($this->ShadowAttribute->save($this->request->data)) {
// list the ones that succeeded
$emailResult = "";
if (!$this->ShadowAttribute->sendProposalAlertEmail($this->request->data['ShadowAttribute']['event_id'])) {
$emailResult = " but sending out the alert e-mails has failed for at least one recipient.";
if (!isset($this->request->data['ShadowAttribute']['deleted']) || !$this->request->data['ShadowAttribute']['deleted']) {
if (!$this->ShadowAttribute->sendProposalAlertEmail($this->request->data['ShadowAttribute']['event_id'])) {
$emailResult = " but sending out the alert e-mails has failed for at least one recipient.";
}
}
// inform the user and redirect
if ($this->request->is('ajax')) {
@ -691,7 +693,9 @@ class ShadowAttributesController extends AppController {
$this->request->data['ShadowAttribute']['email'] = $this->Auth->user('email');
if ($this->ShadowAttribute->save($this->request->data)) {
$emailResult = "";
if (!$this->ShadowAttribute->sendProposalAlertEmail($this->request->data['ShadowAttribute']['event_id'])) $emailResult = " but sending out the alert e-mails has failed for at least one recipient.";
if (!isset($this->request->data['ShadowAttribute']['deleted']) || !$this->request->data['ShadowAttribute']['deleted']) {
if (!$this->ShadowAttribute->sendProposalAlertEmail($this->request->data['ShadowAttribute']['event_id'])) $emailResult = " but sending out the alert e-mails has failed for at least one recipient.";
}
if ($this->_isRest()) {
$sa = $this->ShadowAttribute->find(
'first',

View File

@ -2022,11 +2022,13 @@ class Server extends AppModel {
$gpgStatus = 2;
$continue = false;
}
try {
$key = $gpg->addSignKey(Configure::read('GnuPG.email'), Configure::read('GnuPG.password'));
} catch (Exception $e) {
$gpgStatus = 3;
$continue = false;
if ($continue) {
try {
$key = $gpg->addSignKey(Configure::read('GnuPG.email'), Configure::read('GnuPG.password'));
} catch (Exception $e) {
$gpgStatus = 3;
$continue = false;
}
}
if ($continue) {
try {