diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-11-15 16:12:20 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-11-15 16:12:20 (GMT) |
commit | da54b908d62351ad17a736df8f39e4fae1001ab4 (patch) | |
tree | 5c0307f6bd8e06aa9a6b008f94bd0ffaacc382dc | |
parent | 72e2b296d6cd6c09e3200149e745406dd77efad3 (diff) |
Do not send redundant update notification to editors
4 files changed, 22 insertions, 34 deletions
diff --git a/site/app/controllers/components/editors.php b/site/app/controllers/components/editors.php index e0cba1f..c9c7a73 100644 --- a/site/app/controllers/components/editors.php +++ b/site/app/controllers/components/editors.php @@ -145,7 +145,7 @@ 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('%s: %s Nomination', SITE_NAME, $emailInfo['name']); + $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->in_reply_to = $version['Version']['in_reply_to']; @@ -304,7 +304,7 @@ 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('%s: %s %s', SITE_NAME, $emailInfo['name'], $emailInfo['version']); + $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->in_reply_to = $version['Version']['in_reply_to']; @@ -373,7 +373,7 @@ class EditorsComponent extends Object { $this->controller->publish('info', $emailInfo, false); $this->controller->Email->template = 'email/inforequest'; $this->controller->Email->to = implode(', ', $authors); - $this->controller->Email->subject = sprintf(SITE_NAME.': %s %s', $emailInfo['name'], $emailInfo['version']); + $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->in_reply_to = $version['Version']['in_reply_to']; @@ -532,21 +532,23 @@ class EditorsComponent extends Object { $this->controller->publish('info', $emailInfo, false); $this->controller->Email->template = '../editors/email/notify_update'; - $this->controller->Email->subject = sprintf(SITE_NAME.': %s Updated', $emailInfo['name']); - if (!empty($_ids)) { - $subscribers = $this->controller->User->findAllById($_ids, null, null, null, null, -1); - - foreach ($subscribers as &$subscriber) { - $this->controller->Email->to = $subscriber['User']['email']; - $result = $this->controller->Email->send(); - // unsubscribe user from further updates - $this->controller->EditorSubscription->cancelUpdates($subscriber['User']['id'], $addonid); - } + // 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); } + return - if ($addon['Addon']['trusted'] == 1 && $release_notify) - $this->_sendReleaseNotes('../editors/', $addonid, $version['Version']['id'], $emailInfo); + $this->controller->Email->subject = sprintf('Mozilla Add-ons: %s Updated', $emailInfo['name']); + + foreach ($subscribers as &$subscriber) { + $this->controller->Email->to = $subscriber['User']['email']; + $result = $this->controller->Email->send(); + // unsubscribe user from further updates + $this->controller->EditorSubscription->cancelUpdates($subscriber['User']['id'], $addonid); + } + } /** @@ -934,7 +936,7 @@ class EditorsComponent extends Object { } } - function _broadcastNotify($addonid, $versionid, $subject, $template) { + function _broadcastNotify($addonid, $versionid, $subject, $template, $update_reply_id=false) { $addon = $this->controller->Addon->findById($addonid); $version = $this->controller->Version->findById($versionid, null, null, null, null, -1); @@ -960,7 +962,7 @@ class EditorsComponent extends Object { $result = $this->controller->Email->send(); - if ($result) + if ($result && $update_reply_id) $this->controller->Version->execute("UPDATE versions SET in_reply_to='{$result}' WHERE id='{$versionid}'"); } } diff --git a/site/app/views/editors/email/notify_nominate_plain.thtml b/site/app/views/editors/email/notify_nominate_plain.thtml index 0fa68b9..db257fb 100644 --- a/site/app/views/editors/email/notify_nominate_plain.thtml +++ b/site/app/views/editors/email/notify_nominate_plain.thtml @@ -1,5 +1,3 @@ -Dear editor, - New activity was nominated to be public. Name: <?=$info['name']?> @@ -7,7 +5,7 @@ Version Number: <?=$info['version']?> URL: <?=FULL_BASE_URL.$html->url("/addon/{$info['id']}")?> Review Link: <?=FULL_BASE_URL.$html->url("/editors/review/{$info['versionid']}")?> -Thanks! + <?=SITE_NAME?> diff --git a/site/app/views/editors/email/notify_pending_plain.thtml b/site/app/views/editors/email/notify_pending_plain.thtml index 2023dcf..df92aa2 100644 --- a/site/app/views/editors/email/notify_pending_plain.thtml +++ b/site/app/views/editors/email/notify_pending_plain.thtml @@ -1,5 +1,3 @@ -Dear editor, - New version of activity is arrived. Name: <?=$info['name']?> @@ -7,7 +5,7 @@ Version Number: <?=$info['version']?> URL: <?=FULL_BASE_URL.$html->url("/addon/{$info['id']}")?> Review Link: <?=FULL_BASE_URL.$html->url("/editors/review/{$info['versionid']}")?> -Thanks! + <?=SITE_NAME?> diff --git a/site/app/views/editors/email/notify_update_plain.thtml b/site/app/views/editors/email/notify_update_plain.thtml index a261078..529e99c 100644 --- a/site/app/views/editors/email/notify_update_plain.thtml +++ b/site/app/views/editors/email/notify_update_plain.thtml @@ -1,22 +1,12 @@ -Dear editor, - -An add-on you previously reviewed was just updated. - - -Add-on Information: +Activity was just updated. Name: <?=$info['name']?> URL: <?=FULL_BASE_URL.$html->url("/addon/{$info['id']}", true, false)?> - Version Number: <?=$info['version']?> Review Link: <?=FULL_BASE_URL.$html->url("/editors/review/{$info['versionid']}", true, false)?> -Thanks! <?=SITE_NAME?> <?=SITE_URL?> - - -This is a one-time notification sent to you because you requested a follow up email regarding queue activity for <?=$info['name']?>. There is no need to unsubscribe if you don't wish to receive further mail. |