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

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 82740768c74e3691728da7e0dbc33d240fa9deeb
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~twom/launchpad:fix-subscription-js-test
Merge into: launchpad:master
Diff against target: 20 lines (+2/-2)
1 file modified
lib/lp/bugs/javascript/subscription.js (+2/-2)
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+407018@code.launchpad.net

Commit message

Guard using the iterable, rather than Object

Description of the change

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

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/bugs/javascript/subscription.js b/lib/lp/bugs/javascript/subscription.js
2index 0ba049a..6faa0f5 100644
3--- a/lib/lp/bugs/javascript/subscription.js
4+++ b/lib/lp/bugs/javascript/subscription.js
5@@ -849,13 +849,13 @@ function safely_render_description(subscription, additional_vars) {
6 var replacements = {};
7 var property;
8 for (property in subscription.vars) {
9- if (Object.prototype.hasOwnProperty(subscription.vars, property)) {
10+ if (subscription.vars.hasOwnProperty(property)) {
11 replacements[property] = var_replacer(
12 undefined, subscription.vars[property]);
13 }
14 }
15 for (property in additional_vars) {
16- if (Object.prototype.hasOwnProperty(additional_vars, property)) {
17+ if (additional_vars.hasOwnProperty(property)) {
18 replacements[property] = var_replacer(
19 property, additional_vars[property]);
20 }

Subscribers

People subscribed via source and target branches

to status/vote changes: