Skip to content

Commit 5ebca7f

Browse files
committed
Fix wrong condition, results in the snippet always being re-saved.
This fixes a bad condition introduced in: ca2f69f Fortunately, there is no bug caused by this. Just resulted in the snippet always being stored in the db every time the config is saved, one unnecessary write though.
1 parent 3f99f5f commit 5ebca7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/code/community/Zendesk/Zendesk/Model/Observer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ public function saveConfig(Varien_Event_Observer $observer)
111111
}
112112

113113
// Case insensitive search with single and double quotes, still better performance than 1 regexp search
114-
$hasUnatchedSnippet = stripos($widgetSnippet, "'{$zDomain}'") === false && stripos($widgetSnippet, '"'.$zDomain.'"') === false;
115-
if (! $hasUnmatchedSnippet) {
114+
$missingSnippet = stripos($widgetSnippet, "'{$zDomain}'") === false && stripos($widgetSnippet, '"'.$zDomain.'"') === false;
115+
if ($missingSnippet) {
116116
$webWidgetSnippet=<<<EOJS
117117
<!-- Start of Zendesk Widget script -->
118118
<script>/*<![CDATA[*/window.zEmbed||function(e,t){var n,o,d,i,s,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(c){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){var o=this.createElement("script");n&&(this.domain=n),o.id="js-iframe-async",o.src=e,this.t=+new Date,this.zendeskHost=t,this.zEQueue=a,this.body.appendChild(o)},o.write('<body onload="document._l();">'),o.close()}("https://assets.zendesk.com/embeddable_framework/main.js","{$zDomain}");/*]]>*/</script>

0 commit comments

Comments
 (0)