Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix insight permalink in HTML notification email

Possibly related to #1787
  • Loading branch information...
commit 376b4024514b4fba4f75ee162a7ee786d0ae5646 1 parent 2011b6e
Gina Trapani ginatrapani authored
4 webapp/plugins/insightsgenerator/model/class.InsightsGeneratorPlugin.php
View
@@ -216,7 +216,7 @@ private function sendDigestSinceWithTemplate($owner, $start, $template, &$option
$parameters = array();
$parameters['insights'] = $insights;
$parameters['app_title'] = $config->getValue('app_title_prefix')."ThinkUp";
- $parameters['app_url'] = Utils::getApplicationURL();
+ $parameters['application_url'] = Utils::getApplicationURL();
$parameters['unsub_url'] = Utils::getApplicationURL().'account/index.php?m=manage#instances';;
// It's a weekly digest if we're going back more than a day or two.
$days_ago = ($this->current_timestamp - strtotime($start)) / (60*60*24);
@@ -235,7 +235,7 @@ private function sendDigestSinceWithTemplate($owner, $start, $template, &$option
}
}
- $view->assign('apptitle', $config->getValue('app_title_prefix')."ThinkUp" );
+ $view->assign('app_title', $config->getValue('app_title_prefix')."ThinkUp" );
$view->assign('application_url', Utils::getApplicationURL());
$view->assign('insights', $insights);
$message = $view->fetch(Utils::getPluginViewDirectory($this->folder_name).$template);
8 webapp/plugins/insightsgenerator/tests/TestOfInsightsGeneratorPlugin.php
View
@@ -172,6 +172,8 @@ public function testWeeklySendSetting() {
'slug'=>'new_group_memberships', 'prefix'=>'Made the List:',
'text'=>'CDMoyer is on 29 new lists',
'time_generated'=>date('Y-m-d 03:00:00', strtotime($day_to_run.' 5pm')-(60*60*24*3))));
+ $builders[] = FixtureBuilder::build('options', array('namespace'=>'application_options',
+ 'option_name'=>'server_name', 'option_value'=>'example.com'));
$plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
$options = $plugin_option_dao->getOptionsHash($plugin->folder_name, true);
@@ -193,9 +195,11 @@ public function testWeeklySendSetting() {
$this->assertNotNull($options['last_weekly_email']);
$this->assertNotNull($options['last_daily_email']);
$sent = Mailer::getLastMail();
+ $this->debug($sent);
$this->assertNotEqual('', $sent);
$this->assertPattern('/to.*weekly@example.com/', $sent);
$this->assertPattern('/29 new lists/', $sent);
+ $this->assertPattern('/example.com/', $sent);
unlink(FileDataManager::getDataPath(Mailer::EMAIL));
$plugin->crawl();
@@ -332,13 +336,17 @@ public function testMandrillHTML() {
'slug'=>'new_group_memberships', 'prefix'=>'Made the List:',
'text'=>'Joe Test is on 1234 new lists',
'time_generated'=>date('Y-m-d 03:00:00', strtotime('1am'))));
+ $builders[] = FixtureBuilder::build('options', array('namespace'=>'application_options',
+ 'option_name'=>'server_name', 'option_value'=>'downtonabb.ey'));
$this->simulateLogin('admin@example.com');
$plugin->current_timestamp = strtotime('5pm');
$plugin->crawl();
$sent = Mailer::getLastMail();
+ $this->assertPattern('/http:\/\/downtonabb.ey/', $sent);
// We can tell if it's HTML because we'll have a JSON block to decode
+ $this->debug($sent);
$decoded = json_decode($sent);
$this->assertNull($decoded);
unlink(FileDataManager::getDataPath(Mailer::EMAIL));
2  webapp/plugins/insightsgenerator/view/_email.daily_insight_digest.tpl
View
@@ -9,5 +9,5 @@ ThinkUp has new insights for you!
{/if}
{/foreach}
-Sent to you by {$apptitle}.
+Sent to you by {$app_title}.
Change your mail preferences: {$application_url}account/index.php?m=manage#instances
2  webapp/plugins/insightsgenerator/view/_email.weekly_insight_digest.tpl
View
@@ -9,5 +9,5 @@ This week's ThinkUp insights
{/if}
{/foreach}
-Sent to you by {$apptitle}.
+Sent to you by {$app_title}.
Change your mail preferences: {$application_url}account/index.php?m=manage#instances
Please sign in to comment.
Something went wrong with that request. Please try again.