Skip to content

Commit 8eb5898

Browse files
committed
Used object shorthand on useMasterKey
1 parent c714105 commit 8eb5898

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/dashboard/Data/Browser/Browser.react.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class Browser extends DashboardView {
167167
if (isRelationRoute && !relation) {
168168
const parentObjectQuery = new Parse.Query(className);
169169
const { useMasterKey } = this.state;
170-
const parent = await parentObjectQuery.get(entityId, { useMasterKey: useMasterKey });
170+
const parent = await parentObjectQuery.get(entityId, { useMasterKey });
171171
relation = parent.relation(relationName);
172172
}
173173
await this.setState({
@@ -383,7 +383,7 @@ class Browser extends DashboardView {
383383

384384
query.limit(MAX_ROWS_FETCHED);
385385

386-
let promise = query.find({ useMasterKey: useMasterKey });
386+
let promise = query.find({ useMasterKey });
387387
let isUnique = false;
388388
let uniqueField = null;
389389
filters.forEach(async (filter) => {
@@ -403,7 +403,7 @@ class Browser extends DashboardView {
403403
async fetchParseDataCount(source, filters) {
404404
const query = queryFromFilters(source, filters);
405405
const { useMasterKey } = this.state;
406-
const count = await query.count({ useMasterKey: useMasterKey });
406+
const count = await query.count({ useMasterKey });
407407
return count;
408408
}
409409

@@ -481,7 +481,7 @@ class Browser extends DashboardView {
481481
query.limit(MAX_ROWS_FETCHED);
482482

483483
const { useMasterKey } = this.state;
484-
query.find({ useMasterKey: useMasterKey }).then((nextPage) => {
484+
query.find({ useMasterKey }).then((nextPage) => {
485485
if (className === this.props.params.className) {
486486
this.setState((state) => ({
487487
data: state.data.concat(nextPage)
@@ -573,7 +573,7 @@ class Browser extends DashboardView {
573573
obj.set(attr, value);
574574
}
575575
const { useMasterKey } = this.state;
576-
obj.save(null, { useMasterKey: useMasterKey }).then((objectSaved) => {
576+
obj.save(null, { useMasterKey }).then((objectSaved) => {
577577
const createdOrUpdated = isNewObject ? 'created' : 'updated';
578578
let msg = objectSaved.className + ' with id \'' + objectSaved.id + '\' ' + createdOrUpdated;
579579
this.showNote(msg, false);
@@ -587,7 +587,7 @@ class Browser extends DashboardView {
587587
const parentRelation = parent.relation(relation.key);
588588
parentRelation.add(obj);
589589
const targetClassName = relation.targetClassName;
590-
parent.save(null, { useMasterKey: useMasterKey }).then(() => {
590+
parent.save(null, { useMasterKey }).then(() => {
591591
this.setState({
592592
newObject: null,
593593
data: [
@@ -668,7 +668,7 @@ class Browser extends DashboardView {
668668
let relation = this.state.relation;
669669
if (relation && toDelete.length) {
670670
relation.remove(toDelete);
671-
relation.parent.save(null, { useMasterKey: useMasterKey }).then(() => {
671+
relation.parent.save(null, { useMasterKey }).then(() => {
672672
if (this.state.relation === relation) {
673673
for (let i = 0; i < indexes.length; i++) {
674674
this.state.data.splice(indexes[i] - i, 1);
@@ -679,7 +679,7 @@ class Browser extends DashboardView {
679679
}
680680
});
681681
} else if (toDelete.length) {
682-
Parse.Object.destroyAll(toDelete, { useMasterKey: useMasterKey }).then(() => {
682+
Parse.Object.destroyAll(toDelete, { useMasterKey }).then(() => {
683683
let deletedNote;
684684

685685
if (toDeleteObjectIds.length == 1) {
@@ -777,7 +777,7 @@ class Browser extends DashboardView {
777777
const query = new Parse.Query(relation.targetClassName);
778778
const parent = relation.parent;
779779
query.containedIn('objectId', objectIds);
780-
let objects = await query.find({ useMasterKey: useMasterKey });
780+
let objects = await query.find({ useMasterKey });
781781
const missedObjectsCount = objectIds.length - objects.length;
782782
if (missedObjectsCount) {
783783
const missedObjects = [];
@@ -791,7 +791,7 @@ class Browser extends DashboardView {
791791
throw `${errorSummary} ${JSON.stringify(missedObjects)}`;
792792
}
793793
parent.relation(relation.key).add(objects);
794-
await parent.save(null, { useMasterKey: useMasterKey });
794+
await parent.save(null, { useMasterKey });
795795
// remove duplication
796796
this.state.data.forEach(origin => objects = objects.filter(object => object.id !== origin.id));
797797
this.setState({
@@ -819,12 +819,12 @@ class Browser extends DashboardView {
819819
async confirmAttachSelectedRows(className, targetObjectId, relationName, objectIds, targetClassName) {
820820
const { useMasterKey } = this.state;
821821
const parentQuery = new Parse.Query(className);
822-
const parent = await parentQuery.get(targetObjectId, { useMasterKey: useMasterKey });
822+
const parent = await parentQuery.get(targetObjectId, { useMasterKey });
823823
const query = new Parse.Query(targetClassName || this.props.params.className);
824824
query.containedIn('objectId', objectIds);
825-
const objects = await query.find({ useMasterKey: useMasterKey });
825+
const objects = await query.find({ useMasterKey });
826826
parent.relation(relationName).add(objects);
827-
await parent.save(null, { useMasterKey: useMasterKey });
827+
await parent.save(null, { useMasterKey });
828828
this.setState({
829829
selection: {},
830830
});
@@ -850,12 +850,12 @@ class Browser extends DashboardView {
850850
}
851851
const query = new Parse.Query(this.props.params.className);
852852
query.containedIn('objectId', objectIds);
853-
const objects = await query.find({ useMasterKey: useMasterKey });
853+
const objects = await query.find({ useMasterKey });
854854
const toClone = [];
855855
for (const object of objects) {
856856
toClone.push(object.clone());
857857
}
858-
await Parse.Object.saveAll(toClone, { useMasterKey: useMasterKey });
858+
await Parse.Object.saveAll(toClone, { useMasterKey });
859859
this.setState({
860860
selection: {},
861861
data: [

0 commit comments

Comments
 (0)