← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~twom/launchpad:fix-subscription-js-test into launchpad:master

 

Tom Wardill has proposed merging ~twom/launchpad:fix-subscription-js-test into launchpad:master.

Commit message:
Guard using the iterable, rather than Object

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

We have an Array here, so we need to use the iterable's hasOwnProperty, rather than Object.

Following the 'Difference between for..of and for..in' section of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:fix-subscription-js-test into launchpad:master.
diff --git a/lib/lp/bugs/javascript/subscription.js b/lib/lp/bugs/javascript/subscription.js
index 0ba049a..6faa0f5 100644
--- a/lib/lp/bugs/javascript/subscription.js
+++ b/lib/lp/bugs/javascript/subscription.js
@@ -849,13 +849,13 @@ function safely_render_description(subscription, additional_vars) {
     var replacements = {};
     var property;
     for (property in subscription.vars) {
-        if (Object.prototype.hasOwnProperty(subscription.vars, property)) {
+        if (subscription.vars.hasOwnProperty(property)) {
             replacements[property] = var_replacer(
                 undefined, subscription.vars[property]);
         }
     }
     for (property in additional_vars) {
-        if (Object.prototype.hasOwnProperty(additional_vars, property)) {
+        if (additional_vars.hasOwnProperty(property)) {
             replacements[property] = var_replacer(
                 property, additional_vars[property]);
         }