Skip to content

Commit 665e292

Browse files
alencarlucasdavimacedo
authored andcommitted
fix: Can't access method 'hasOwnProperty' from target object (#1172)
1 parent a0f674e commit 665e292

File tree

9 files changed

+18
-20
lines changed

9 files changed

+18
-20
lines changed

package-lock.json

+6-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/BrowserCell/BrowserCell.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ let BrowserCell = ({ type, value, hidden, width, current, onSelect, onEditChange
6565
} else if (type === 'ACL') {
6666
let pieces = [];
6767
let json = value.toJSON();
68-
if (json.hasOwnProperty('*')) {
68+
if (Object.prototype.hasOwnProperty.call(json, '*')) {
6969
if (json['*'].read && json['*'].write) {
7070
pieces.push('Public Read + Write');
7171
} else if (json['*'].read) {

src/components/ExplorerQueryComposer/ExplorerQueryComposer.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ export default class ExplorerQueryComposer extends React.Component {
370370
}
371371

372372
renderFilter(filter, index=0) {
373-
let type = Constraints[filter.op].hasOwnProperty('field') ? Constraints[filter.op].field : FIELD_TYPE[filter.col];
373+
let type = Object.prototype.hasOwnProperty.call(Constraints[filter.op], 'field') ? Constraints[filter.op].field : FIELD_TYPE[filter.col];
374374

375375
let constraintView = null;
376376
if (type === 'JSON') {

src/components/Filter/Filter.react.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function changeField(schema, filters, index, newField) {
2222
function changeConstraint(schema, filters, index, newConstraint) {
2323
let field = filters.get(index).get('field');
2424
let compareType = schema[field].type;
25-
if (Filters.Constraints[newConstraint].hasOwnProperty('field')) {
25+
if (Object.prototype.hasOwnProperty.call(Filters.Constraints[newConstraint], 'field')) {
2626
compareType = Filters.Constraints[newConstraint].field;
2727
}
2828
let newFilter = new Map({
@@ -59,7 +59,7 @@ let Filter = ({ schema, filters, renderRow, onChange, blacklist }) => {
5959
fields.sort();
6060
let constraints = Filters.FieldConstraints[schema[field].type].filter((c) => blacklist.indexOf(c) < 0);
6161
let compareType = schema[field].type;
62-
if (Filters.Constraints[constraint].hasOwnProperty('field')) {
62+
if (Object.prototype.hasOwnProperty.call(Filters.Constraints[constraint], 'field')) {
6363
compareType = Filters.Constraints[constraint].field;
6464
}
6565
return renderRow({

src/components/PushAudienceDialog/PushAudienceDialog.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const AUDIENCE_SIZE_FETCHING_ENABLED = true;
3232
let filterFormatter = (filters, schema) => {
3333
return filters.map((filter) => {
3434
let type = schema[filter.get('field')];
35-
if (Filters.Constraints[filter.get('constraint')].hasOwnProperty('field')) {
35+
if (Object.prototype.hasOwnProperty.call(Filters.Constraints[filter.get('constraint')], 'field')) {
3636
type = Filters.Constraints[filter.get('constraint')].field;
3737
}
3838
// Format any stringified fields

src/dashboard/Analytics/SlowQueries/SlowQueries.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class SlowQueries extends TableView {
129129
let os = value['OS'];
130130
let version = value['App Display Version'];
131131
if (os === null || version === null) return;
132-
if (appVersions.hasOwnProperty(os)) {
132+
if (Object.prototype.hasOwnProperty.call(appVersions, os)) {
133133
appVersions[os].push(version);
134134
} else {
135135
appVersions[os] = [version];

src/dashboard/Push/PushIndex.react.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ let isChannelTargeted = (pushData) => {
9898
let additionalKeys = false;
9999

100100
for (let key in queryJSON) {
101-
if (queryJSON.hasOwnProperty(key)) {
101+
if (Object.prototype.hasOwnProperty.call(queryJSON, key)) {
102102
if (key !== 'deviceType' && key !== 'channels') {
103103
additionalKeys = true;
104104
}

src/lib/AJAX.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function request(method, url, body, abortable = false, withCredentials =
5959
p.reject(this.responseText);
6060
return;
6161
}
62-
if (json.hasOwnProperty('success') && json.success === false) {
62+
if (Object.prototype.hasOwnProperty.call(json, 'success') && json.success === false) {
6363
p.reject(json);
6464
} else {
6565
p.resolve(json);

src/lib/PushUtils.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ let formatConstraintComponent = (key, operation, value, schema) => {
159159
let formatStructure = (key, constraints, schema) => {
160160
let rows = [];
161161
for(let prop in constraints){
162-
if(constraints.hasOwnProperty(prop)){
162+
if(Object.prototype.hasOwnProperty.call(constraints, prop)){
163163
rows.push(formatConstraintComponent(key, prop, constraints[prop], schema));
164164
}
165165
}
@@ -287,9 +287,9 @@ export function largeInfoBuilder(query, schema, styles = {}) {
287287
<ul className={styles.installationInfo}>
288288
<li className={styles.detailsHeaderListItem}>INSTALLATION CONDITIONS</li>
289289
{conditionRows}
290-
</ul> :
290+
</ul> :
291291
null
292-
}
292+
}
293293
</div>
294294
)
295295
}
@@ -307,7 +307,7 @@ let tableInfoBuilderHelper = (styles, key, description, value) => {
307307
export function tableInfoBuilder(query, schema, styles = {}) {
308308
try {
309309
query = JSON.parse(query);
310-
} catch(e) {/**/}
310+
} catch(e) {/**/}
311311

312312
if(!query) {
313313
return;

0 commit comments

Comments
 (0)