diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-11-16 04:09:51 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-11-16 04:09:51 (GMT) |
commit | e73ad835768240402268a17686b901aee55498a2 (patch) | |
tree | a5e2b541d0ea8032f41d918a6cdcb2825925e3c1 | |
parent | 8cb705305a038e0e6fcf3a90be27ea23936ec1ec (diff) |
Fix aslo@ notifications for trusted activities
-rw-r--r-- | site/app/controllers/components/editors.php | 38 | ||||
-rw-r--r-- | site/app/controllers/developers_controller.php | 11 | ||||
-rw-r--r-- | site/app/views/editors/email/pending/public_plain.thtml | 12 | ||||
-rw-r--r-- | site/app/views/editors/email/pending/sandbox_plain.thtml | 7 |
4 files changed, 36 insertions, 32 deletions
diff --git a/site/app/controllers/components/editors.php b/site/app/controllers/components/editors.php index 9ef6b54..0e26dfc 100644 --- a/site/app/controllers/components/editors.php +++ b/site/app/controllers/components/editors.php @@ -150,8 +150,12 @@ class EditorsComponent extends Object { $this->controller->set('info', $emailInfo); - if ($data['Approval']['ActionField'] == 'public') - $this->_sendReleaseNotes('', $this->controller->Addon->id, $version['Version']['id'], $emailInfo); + if ($data['Approval']['ActionField'] == 'public') { + $emailInfo['file_id'] = $version['File'][0]['id']; + $emailInfo['filename'] = $version['File'][0]['filename']; + $emailInfo['version_id'] = $version['Version']['id']; + $this->_sendReleaseNotes('', $emailInfo); + } if ($data['Approval']['ActionField'] != 'superreview') { $this->controller->Email->template = 'email/nominated/'.$data['Approval']['ActionField']; @@ -317,8 +321,12 @@ class EditorsComponent extends Object { } $this->controller->set('info', $emailInfo); - if ($data['Approval']['ActionField'] == 'public') - $this->_sendReleaseNotes('', $this->controller->Addon->id, $version['Version']['id'], $emailInfo); + if ($data['Approval']['ActionField'] == 'public') { + $emailInfo['file_id'] = $version['File'][0]['id']; + $emailInfo['filename'] = $version['File'][0]['filename']; + $emailInfo['version_id'] = $version['Version']['id']; + $this->_sendReleaseNotes('', $emailInfo); + } if ($data['Approval']['ActionField'] != 'superreview') { $this->controller->Email->template = 'email/pending/'.$data['Approval']['ActionField']; @@ -543,7 +551,7 @@ class EditorsComponent extends Object { * @param int $addonid ID of add-on that was updated * @param int $versionid ID of the add-on's new version */ - function updateNotify($addonid, $versionid, $release_notify) { + function updateNotify($addonid, $versionid, $file_id=null, $file_name=null) { $_ids = $this->controller->EditorSubscription->getSubscribers($addonid); $addon = $this->controller->Addon->findById($addonid); @@ -562,9 +570,12 @@ class EditorsComponent extends Object { $this->controller->Email->template = '../editors/email/notify_update'; // we are sugar - if ($addon['Addon']['trusted'] == 1 && $release_notify) { - $this->_sendReleaseNotes('../editors/', $addonid, $version['Version']['id'], $emailInfo); - $this->_broadcastNotify($addonid, $versionid, '[PUBLIC] %s', '../editors/email/notify_update', false); + if ($addon['Addon']['trusted'] == 1 && $file_id && $file_name) { + $emailInfo['file_id'] = $file_id; + $emailInfo['filename'] = $file_name; + $emailInfo['version_id'] = $version['Version']['id']; + $this->_sendReleaseNotes('../editors/', $emailInfo); + $this->_broadcastNotify($addonid, $versionid, '[PUBLIC] %s', '../editors/email/pending/public', false); } return @@ -938,9 +949,10 @@ class EditorsComponent extends Object { return true; } - function _sendReleaseNotes($prefix, $addon_id, $version_id, $emailInfo) { + function _sendReleaseNotes($prefix, $emailInfo) { global $SITE_RELEASE_EMAIL; + $version_id = $emailInfo['version_id']; $releasenotes = $this->controller->Version->getReleaseNotesLocales($version_id); $en = isset($releasenotes['en-US']) ? $releasenotes['en-US'] : ''; $version = $this->controller->Version->findById($version_id, null, null, null, null, -1); @@ -949,9 +961,6 @@ class EditorsComponent extends Object { $emailInfo['min'] = $compat['Min_Version']['version']; $emailInfo['max'] = $compat['Max_Version']['version']; - $emailInfo['version_id'] = $version_id; - $emailInfo['file_id'] = $version['File'][0]['id']; - $emailInfo['filename'] = $version['File'][0]['filename']; foreach ($SITE_RELEASE_EMAIL as $locale => $props) { $emailInfo['releasenotes'] = isset($releasenotes[$locale]) ? $releasenotes[$locale] : $en; @@ -980,7 +989,10 @@ class EditorsComponent extends Object { 'id' => $addonid, 'name' => $addon['Translation']['name']['string'], 'versionid' => $versionid, - 'version' => $version['Version']['version'] + 'version' => $version['Version']['version'], + 'files' => array(), + 'reviewer' => '', + 'comments' => 'Trusted activity' ); $this->controller->publish('info', $emailInfo, false); diff --git a/site/app/controllers/developers_controller.php b/site/app/controllers/developers_controller.php index a540b34..201c497 100644 --- a/site/app/controllers/developers_controller.php +++ b/site/app/controllers/developers_controller.php @@ -425,9 +425,6 @@ class DevelopersController extends AppController $this->Version->addCompatibleApp($version_id, SITE_APP, $data['appversion_min'], $data['appversion_max']); $this->Version->saveTranslations($version_id, $data['form.data.Version'], $data['localizedFields']); - - // notify subscribed editors of update (if any) - $this->Editors->updateNotify($addon['Addon']['id'], $version_id, true); } // Add Files @@ -457,6 +454,7 @@ class DevelopersController extends AppController $this->File->save($data['File']['db']); $file_id = $this->File->id; + $file_name = $validate['filename']; // only log file creation if separate from version creation if (!empty($data['Version']['id'])) { @@ -476,6 +474,11 @@ class DevelopersController extends AppController if ($data['File']['db']['status'] == STATUS_PENDING) $this->Editors->pendingNotify($addon_id, $version_id); + if ($type == 'update') { + // notify subscribed editors of update (if any) + $this->Editors->updateNotify($addon_id, $version_id, $file_id, $file_name); + } + return array( 'error' => 0, 'uploadtype' => $type, @@ -1404,7 +1407,7 @@ class DevelopersController extends AppController // notify subscribed editors of update global $valid_status; $version_id = $this->Version->getVersionByAddonId($addon['Addon']['id'], $valid_status); - $this->Editors->updateNotify($addon['Addon']['id'], $version_id, false); + $this->Editors->updateNotify($addon['Addon']['id'], $version_id); $this->Editors->nominateNotify($addon['Addon']['id'], $version_id); } } diff --git a/site/app/views/editors/email/pending/public_plain.thtml b/site/app/views/editors/email/pending/public_plain.thtml index 657692d..bb1b103 100644 --- a/site/app/views/editors/email/pending/public_plain.thtml +++ b/site/app/views/editors/email/pending/public_plain.thtml @@ -1,20 +1,12 @@ -The following files of <?=$info['name']?> <?=$info['version']?> have been made public by a <?=SITE_NAME?> editor: - -<?php - foreach ($info['files'] as $file) { - echo $file."\n"; - } -?> +Activity <?=$info['name']?>-<?=$info['version']?> have been made public by a <?=SITE_NAME?> editor. Review Information: Reviewer: <?=$info['reviewer']?> -Tested on <?=$info['os']?> with <?=$info['apps']?> - Comments: <?=$info['comments']?> -If you have questions about this review, please e-mail <?=EDITOR_EMAIL?> or join <?=SITE_IRC?>. +If you have questions about this review, please answer to this e-mail or join <?=SITE_IRC?>. <?=SITE_NAME?> diff --git a/site/app/views/editors/email/pending/sandbox_plain.thtml b/site/app/views/editors/email/pending/sandbox_plain.thtml index 7c34917..b515873 100644 --- a/site/app/views/editors/email/pending/sandbox_plain.thtml +++ b/site/app/views/editors/email/pending/sandbox_plain.thtml @@ -1,15 +1,12 @@ -The following files of <?=$info['name']?> <?=$info['version']?> have been retained in the sandbox by a <?=SITE_NAME?> editor: - +Activity <?=$info['name']?>-<?=$info['version']?> have been retained in the sandbox by a <?=SITE_NAME?> editor. Review Information: Reviewer: <?=$info['reviewer']?> -Tested on <?=$info['os']?> with <?=$info['apps']?> - Comments: <?=$info['comments']?> -If you have questions about this review, please e-mail <?=EDITOR_EMAIL?> or join <?=SITE_IRC?>. +If you have questions about this review, please answer to this e-mail or join <?=SITE_IRC?>. <?=SITE_NAME?> |