From 7aeaf74c223611514f01a8db34c91f64b1f9c950 Mon Sep 17 00:00:00 2001 From: Jeremy Thomerson Date: Fri, 21 Jun 2013 02:16:07 +0000 Subject: [PATCH] MINOR: fix Email class modifying SSViewer.source_file_comments config val The Email class was updating the SSViewer.source_file_comments value and not resetting it. If someone had this value set to true in their system and then used the Email class, it seems there would be an unintended side-effect of having the source file comments turned off. --- email/Email.php | 4 +++- tests/view/SSViewerTest.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/email/Email.php b/email/Email.php index 714650bb9..6aa8c4811 100644 --- a/email/Email.php +++ b/email/Email.php @@ -349,8 +349,9 @@ class Email extends ViewableData { * and it won't be plain email :) */ protected function parseVariables($isPlain = false) { + $origState = Config::inst()->get('SSViewer', 'source_file_comments'); Config::inst()->update('SSViewer', 'source_file_comments', false); - + if(!$this->parseVariables_done) { $this->parseVariables_done = true; @@ -373,6 +374,7 @@ class Email extends ViewableData { // Rewrite relative URLs $this->body = HTTP::absoluteURLs($fullBody); } + Config::inst()->update('SSViewer', 'source_file_comments', $origState); } /** diff --git a/tests/view/SSViewerTest.php b/tests/view/SSViewerTest.php index 92b181b28..4a10ff41e 100644 --- a/tests/view/SSViewerTest.php +++ b/tests/view/SSViewerTest.php @@ -1062,7 +1062,7 @@ after') $origEnv = Config::inst()->get('Director', 'environment_type'); Config::inst()->update('Director', 'environment_type', 'dev'); Config::inst()->update('SSViewer', 'source_file_comments', true); - $f = FRAMEWORK_PATH . '/tests/templates/SSViewerTestComments'; + $f = FRAMEWORK_PATH . '/tests/templates/SSViewerTestComments'; $templates = array( array( 'name' => 'SSViewerTestCommentsFullSource',