diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-11-16 01:47:17 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-11-16 01:47:17 (GMT) |
commit | 8cb705305a038e0e6fcf3a90be27ea23936ec1ec (patch) | |
tree | ff5398061ff345e665d0716944685802aa09f7df | |
parent | e7815e2a66d85dd0a0ce47d2a0c8ddb85c3075c0 (diff) |
Fix aslo@ notification
-rw-r--r-- | site/app/controllers/addons_controller.php | 2 | ||||
-rw-r--r-- | site/app/controllers/components/editors.php | 68 | ||||
-rw-r--r-- | site/app/controllers/developers_controller.php | 2 | ||||
-rw-r--r-- | site/app/controllers/editors_controller.php | 6 | ||||
-rw-r--r-- | site/app/views/editors/review.thtml | 7 |
5 files changed, 52 insertions, 33 deletions
diff --git a/site/app/controllers/addons_controller.php b/site/app/controllers/addons_controller.php index 09bb753..16de817 100644 --- a/site/app/controllers/addons_controller.php +++ b/site/app/controllers/addons_controller.php @@ -270,7 +270,7 @@ class AddonsController extends AppController $addon_data = $this->Addon->getAddon($id, $_associations); // Only show valid, active add-ons. Not doing this in SQL because we want to use the cache invalidation framework. more in bug 501187 - if (empty($addon_data) + if (empty($addon_data) || empty($addon_data['Addon']) || $addon_data['Addon']['inactive'] == 1 || !in_array($addon_data['Addon']['addontype_id'], array(ADDON_EXTENSION, ADDON_THEME, ADDON_DICT, ADDON_SEARCH, ADDON_LPAPP, ADDON_PLUGIN)) || !in_array($addon_data['Addon']['status'], $valid_status)) { diff --git a/site/app/controllers/components/editors.php b/site/app/controllers/components/editors.php index c9c7a73..9ef6b54 100644 --- a/site/app/controllers/components/editors.php +++ b/site/app/controllers/components/editors.php @@ -123,9 +123,12 @@ class EditorsComponent extends Object { return false; } + $authors = array(); if (!empty($addon['User'])) { foreach ($addon['User'] as $user) { - $authors[] = $user['email']; + $user_full = $this->controller->User->findById($user['id']); + if (!$this->controller->SimpleAcl->actionAllowed('Editors', '*', $user_full)) + $authors[] = $user['email']; } } @@ -136,6 +139,14 @@ class EditorsComponent extends Object { 'comments' => $data['Approval']['comments'], 'version' => !empty($version) ? $version['Version']['version'] : '' ); + + if (empty($authors)) { + $emailInfo['email'] = EDITOR_EMAIL; + $this->controller->Email->to = EDITOR_EMAIL; + } else { + $this->controller->Email->to = $emailInfo['email']; + $this->controller->Email->cc = array(EDITOR_EMAIL); + } $this->controller->set('info', $emailInfo); @@ -144,10 +155,8 @@ class EditorsComponent extends Object { if ($data['Approval']['ActionField'] != 'superreview') { $this->controller->Email->template = 'email/nominated/'.$data['Approval']['ActionField']; - $this->controller->Email->to = $emailInfo['email']; - $this->controller->Email->subject = sprintf('[RELEASE] %s-%s', $emailInfo['name'], $emailInfo['version']); - $this->controller->Email->cc = array(EDITOR_EMAIL); - $this->controller->Email->reply_to = array(EDITOR_EMAIL, $this->controller->Email->to); + $this->controller->Email->subject = sprintf('[%s] %s-%s', strtoupper($data['Approval']['ActionField']), $emailInfo['name'], $emailInfo['version']); + $this->controller->Email->reply_to = array_merge(array(EDITOR_EMAIL), $authors); $this->controller->Email->in_reply_to = $version['Version']['in_reply_to']; } else { @@ -280,9 +289,12 @@ class EditorsComponent extends Object { } } + $authors = array(); if (!empty($addon['User'])) { foreach ($addon['User'] as $user) { - $authors[] = $user['email']; + $user_full = $this->controller->User->findById($user['id']); + if (!$this->controller->SimpleAcl->actionAllowed('Editors', '*', $user_full)) + $authors[] = $user['email']; } } @@ -296,6 +308,13 @@ class EditorsComponent extends Object { 'version' => !empty($version) ? $version['Version']['version'] : '', 'files' => $files ); + if (empty($authors)) { + $emailInfo['email'] = EDITOR_EMAIL; + $this->controller->Email->to = EDITOR_EMAIL; + } else { + $this->controller->Email->to = $emailInfo['email']; + $this->controller->Email->cc = array(EDITOR_EMAIL); + } $this->controller->set('info', $emailInfo); if ($data['Approval']['ActionField'] == 'public') @@ -303,10 +322,8 @@ class EditorsComponent extends Object { if ($data['Approval']['ActionField'] != 'superreview') { $this->controller->Email->template = 'email/pending/'.$data['Approval']['ActionField']; - $this->controller->Email->to = $emailInfo['email']; - $this->controller->Email->subject = sprintf('[RELEASE] %s-%s', $emailInfo['name'], $emailInfo['version']); - $this->controller->Email->cc = array(EDITOR_EMAIL); - $this->controller->Email->reply_to = array(EDITOR_EMAIL, $this->controller->Email->to); + $this->controller->Email->subject = sprintf('[%s] %s-%s', strtoupper($data['Approval']['ActionField']), $emailInfo['name'], $emailInfo['version']); + $this->controller->Email->reply_to = array_merge(array(EDITOR_EMAIL), $authors); $this->controller->Email->in_reply_to = $version['Version']['in_reply_to']; } else { @@ -324,7 +341,7 @@ class EditorsComponent extends Object { * Request more information from an author regarding an update/nomination * request */ - function requestInformation($addon, $data) { + function requestInformation($addon, $versionid, $data) { global $valid_status; $file_id = 0; @@ -355,27 +372,38 @@ class EditorsComponent extends Object { // send email to all authors $authors = array(); - foreach ($addon['User'] as &$user) $authors[] = $user['email']; + if (!empty($addon['User'])) { + foreach ($addon['User'] as $user) { + $user_full = $this->controller->User->findById($user['id']); + if (!$this->controller->SimpleAcl->actionAllowed('Editors', '*', $user_full)) + $authors[] = $user['email']; + } + } - $versionid = $this->controller->Version->getVersionByAddonId($addon['Addon']['id'], $valid_status); $version = $this->controller->Version->findById($versionid, null, null, -1); // log addon action $this->controller->Addonlog->logRequestVersion($this->controller, $addon['Addon']['id'], $versionid, $version['Version']['version']); $emailInfo = array( + 'email' => implode(', ', $authors), 'name' => $addon['Translation']['name']['string'], 'infoid' => $infoid, 'reviewer' => $session['firstname'].' '.$session['lastname'], 'comments' => $data['Approval']['comments'], 'version' => !empty($version) ? $version['Version']['version'] : '' ); + if (empty($authors)) { + $emailInfo['email'] = EDITOR_EMAIL; + $this->controller->Email->to = EDITOR_EMAIL; + } else { + $this->controller->Email->to = $emailInfo['email']; + $this->controller->Email->cc = array(EDITOR_EMAIL); + } $this->controller->publish('info', $emailInfo, false); $this->controller->Email->template = 'email/inforequest'; - $this->controller->Email->to = implode(', ', $authors); $this->controller->Email->subject = sprintf('[REQUEST] %s-%s', $emailInfo['name'], $emailInfo['version']); - $this->controller->Email->cc = array(EDITOR_EMAIL); - $this->controller->Email->reply_to = array(EDITOR_EMAIL, $this->controller->Email->to); + $this->controller->Email->reply_to = array_merge(array(EDITOR_EMAIL), $authors); $this->controller->Email->in_reply_to = $version['Version']['in_reply_to']; $this->controller->Email->send(); } @@ -536,7 +564,7 @@ class EditorsComponent extends Object { // we are sugar if ($addon['Addon']['trusted'] == 1 && $release_notify) { $this->_sendReleaseNotes('../editors/', $addonid, $version['Version']['id'], $emailInfo); - $this->_broadcastNotify($addonid, $versionid, '[RELEASE] %s', '../editors/email/notify_update', false); + $this->_broadcastNotify($addonid, $versionid, '[PUBLIC] %s', '../editors/email/notify_update', false); } return @@ -936,14 +964,16 @@ class EditorsComponent extends Object { } } - function _broadcastNotify($addonid, $versionid, $subject, $template, $update_reply_id=false) { + function _broadcastNotify($addonid, $versionid, $subject, $template, $update_reply_id=true) { $addon = $this->controller->Addon->findById($addonid); $version = $this->controller->Version->findById($versionid, null, null, null, null, -1); $authors = array(); if (!empty($addon['User'])) foreach ($addon['User'] as $user) - $authors[] = $user['email']; + $user_full = $this->controller->User->findById($user['id']); + if (!$this->controller->SimpleAcl->actionAllowed('Editors', '*', $user_full)) + $authors[] = $user['email']; // send out notification email(s) $emailInfo = array( diff --git a/site/app/controllers/developers_controller.php b/site/app/controllers/developers_controller.php index 4033582..a540b34 100644 --- a/site/app/controllers/developers_controller.php +++ b/site/app/controllers/developers_controller.php @@ -785,7 +785,7 @@ class DevelopersController extends AppController // Save some additional data for later $addon['Addon']['id'] = $this->data['Addon']['id']; $addon['Version']['id'] = $this->data['Version']['id']; - $addon['License'] = $this->data['License']; + $addon['License'] = isset($this->data['License']) ? $this->data['License'] : ''; $addon['License.text'] = getitem($this->data, 'License.text'); $addon['form.data.License'] = getitem($this->params, 'form.data.License'); $addon['appversion_min'] = $this->data['appversion_min']; diff --git a/site/app/controllers/editors_controller.php b/site/app/controllers/editors_controller.php index 6c08710..3e863c3 100644 --- a/site/app/controllers/editors_controller.php +++ b/site/app/controllers/editors_controller.php @@ -312,7 +312,7 @@ class EditorsController extends AppController } elseif ($this->data['Approval']['ActionField'] == 'info') { // request more information - $this->Editors->requestInformation($addon, $this->data); + $this->Editors->requestInformation($addon, $version['Version']['id'], $this->data); } elseif ($this->data['Approval']['Type'] == 'nominated') { $this->Editors->reviewNominatedAddon($addon, $this->data); @@ -343,10 +343,6 @@ class EditorsController extends AppController return; } - // if editor chose to be reminded of the next upcoming update, save this - if ($this->data['Approval']['subscribe']) - $this->EditorSubscription->subscribeToUpdates($session['id'], $addon['Addon']['id']); - $this->flash(___('Review successfully processed.'), '/editors/queue/'.$this->data['Approval']['Type']); return; } diff --git a/site/app/views/editors/review.thtml b/site/app/views/editors/review.thtml index f0481bb..13accd1 100644 --- a/site/app/views/editors/review.thtml +++ b/site/app/views/editors/review.thtml @@ -222,13 +222,6 @@ <? } ?> - <div id="subscribe"> - <?php - $_subscribetext = ___('Notify me the next time this add-on is updated. (Subsequent updates will not generate an email)'); - echo $html->checkbox('Approval/subscribe', $_subscribetext); - ?> - <label for="ApprovalSubscribe"><?=$_subscribetext?></label> - </div> <div id="finish"> <?=$html->submit(___('Process Action'), array('id' => 'process', 'onClick' => 'return validateReview(\''.$reviewType.'\');'))?> </div> |