diff options
Diffstat (limited to 'site/app/controllers/editors_controller.php')
-rw-r--r-- | site/app/controllers/editors_controller.php | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/site/app/controllers/editors_controller.php b/site/app/controllers/editors_controller.php index 3770b91..03957bf 100644 --- a/site/app/controllers/editors_controller.php +++ b/site/app/controllers/editors_controller.php @@ -41,7 +41,10 @@ class EditorsController extends AppController { var $name = 'Editors'; - var $uses = array('Addon', 'AddonTag', 'Addontype', 'Application', 'Approval', 'Appversion', 'Cannedresponse', 'Eventlog', 'Favorite', 'File', 'Platform', 'Review', 'ReviewsModerationFlag', 'Tag', 'Translation', 'User', 'Version'); + var $uses = array('Addon', 'AddonTag', 'Addontype', 'Application', 'Approval', + 'Appversion', 'Cannedresponse', 'EditorSubscription', 'Eventlog', 'Favorite', + 'File', 'Platform', 'Review', 'ReviewsModerationFlag', 'Tag', 'Translation', + 'User', 'Version'); var $components = array('Amo', 'Audit', 'Developers', 'Editors', 'Email', 'Error', 'Image', 'Pagination'); var $helpers = array('Html', 'Javascript', 'Ajax', 'Listing', 'Localization', 'Pagination'); @@ -400,7 +403,11 @@ class EditorsController extends AppController if (!empty($this->data)) { //pr($this->data); - if ($this->data['Approval']['Type'] == 'nominated') { + if ($this->data['Approval']['ActionField'] == 'info') { + // request more information + $this->Editors->requestInformation($addon, $this->data); + } + elseif ($this->data['Approval']['Type'] == 'nominated') { $this->Editors->reviewNominatedAddon($addon, $this->data); } else { @@ -408,6 +415,10 @@ class EditorsController extends AppController } if ($this->Error->noErrors()) { + // 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(_('editors_reviewed_successfully'), '/editors/queue/'.$this->data['Approval']['Type']); return; } @@ -462,10 +473,17 @@ class EditorsController extends AppController )); //Review History - if ($history = $this->Approval->findAllByAddon_id($addon['Addon']['id'])) { - foreach ($history as $k => $hist) { - $vLookup = $this->Version->findById($hist['File']['version_id'], array('Version.version')); - $history[$k] = array_merge_recursive($history[$k], $vLookup); + if ($history = $this->Approval->findAll(array('Approval.addon_id' => $addon['Addon']['id'], 'reply_to IS NULL'))) { + foreach ($history as $k => &$hist) { + if (!empty($hist['File']['id'])) { + $vLookup = $this->Version->findById($hist['File']['version_id'], array('Version.version')); + $history[$k] = array_merge_recursive($history[$k], $vLookup); + } + + // add replies to information requests + if ($hist['Approval']['reviewtype'] == 'info') { + $hist['replies'] = $this->Approval->findAll(array('Approval.reply_to' => $hist['Approval']['id']), null, 'Approval.created'); + } } } @@ -489,6 +507,7 @@ class EditorsController extends AppController $this->publish('version', $version); $this->publish('platforms', $platforms); $this->publish('addontypes', $this->Addontype->getNames()); + $this->publish('addontype', $addon['Addon']['addontype_id']); $this->publish('approval', $this->Amo->getApprovalStatus()); $this->publish('history', $history); $this->publish('errors', $this->Error->errors); |