Browse files

Fix issue with Insight URLs in mandrill emails

The application_url used in the template was not being set before rendering
the insights fragment.

Also added test that the a url containing the host/?u= is in the insights
param sent to mandrill.
  • Loading branch information...
1 parent 376b402 commit 3bc8079599aa29efe14d3f9d7531ad49b7e1113c @cdmoyer cdmoyer committed Jan 10, 2014
1 webapp/plugins/insightsgenerator/model/class.InsightsGeneratorPlugin.php
@@ -212,6 +212,7 @@ private function sendDigestSinceWithTemplate($owner, $start, $template, &$option
// If we've got a Mandrill key and template, send HTML
if ($config->getValue('mandrill_api_key') != null && !empty($options['mandrill_template'])) {
$view->assign('insights', $insights);
+ $view->assign('application_url', Utils::getApplicationURL());
$insights = $view->fetch(Utils::getPluginViewDirectory($this->folder_name).'_email.insights_html.tpl');
$parameters = array();
$parameters['insights'] = $insights;
1 webapp/plugins/insightsgenerator/tests/TestOfInsightsGeneratorPlugin.php
@@ -379,6 +379,7 @@ public function testMandrillHTML() {
foreach ($decoded->global_merge_vars as $mv) {
$merge_vars[$mv->name] = $mv->content;
+ $this->assertPattern('/http:\/\/downtonabb.ey\/\?u=/', $merge_vars['insights'], 'Insights URL contains host');
$this->assertPattern('/1234 new lists/', $merge_vars['insights']);
$this->assertEqual($config->getValue('app_title_prefix').'ThinkUp', $merge_vars['app_title']);

0 comments on commit 3bc8079

Please sign in to comment.