← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~twom/launchpad:eslint-subscriptionjs into launchpad:master

 

Tom Wardill has proposed merging ~twom/launchpad:eslint-subscriptionjs into launchpad:master.

Commit message:
Lint for subscription.js

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/406993

Fix trailing new space
Fix guard-for-in errors
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:eslint-subscriptionjs into launchpad:master.
diff --git a/lib/lp/bugs/javascript/subscription.js b/lib/lp/bugs/javascript/subscription.js
index 919991f..0ba049a 100644
--- a/lib/lp/bugs/javascript/subscription.js
+++ b/lib/lp/bugs/javascript/subscription.js
@@ -846,15 +846,19 @@ function safely_render_description(subscription, additional_vars) {
             }
         }
     }
-    var replacements = {}; 
+    var replacements = {};
     var property;
     for (property in subscription.vars) {
-        replacements[property] = var_replacer(
-            undefined, subscription.vars[property]);
+        if (Object.prototype.hasOwnProperty(subscription.vars, property)) {
+            replacements[property] = var_replacer(
+                undefined, subscription.vars[property]);
+        }
     }
     for (property in additional_vars) {
-        replacements[property] = var_replacer(
-            property, additional_vars[property]);
+        if (Object.prototype.hasOwnProperty(additional_vars, property)) {
+            replacements[property] = var_replacer(
+                property, additional_vars[property]);
+        }
     }
     return Y.Lang.sub(subscription.reason, replacements);
 }