Enable prefer-const lint rule (#3202)

This commit is contained in:
Arthur Cinader
2016-12-07 15:17:05 -08:00
committed by Florent Vilmart
parent a6c988176e
commit ca286b7108
106 changed files with 1183 additions and 1183 deletions

View File

@@ -57,7 +57,7 @@ export class PushController extends AdaptableController {
return Promise.resolve();
}
if (body.data && body.data.badge) {
let badge = body.data.badge;
const badge = body.data.badge;
let restUpdate = {};
if (typeof badge == 'string' && badge.toLowerCase() === 'increment') {
restUpdate = { badge: { __op: 'Increment', amount: 1 } }
@@ -66,20 +66,20 @@ export class PushController extends AdaptableController {
} else {
throw "Invalid value for badge, expected number or 'Increment'";
}
let updateWhere = deepcopy(where);
const updateWhere = deepcopy(where);
badgeUpdate = () => {
updateWhere.deviceType = 'ios';
// Build a real RestQuery so we can use it in RestWrite
let restQuery = new RestQuery(config, master(config), '_Installation', updateWhere);
const restQuery = new RestQuery(config, master(config), '_Installation', updateWhere);
return restQuery.buildRestWhere().then(() => {
let write = new RestWrite(config, master(config), '_Installation', restQuery.restWhere, restUpdate);
const write = new RestWrite(config, master(config), '_Installation', restQuery.restWhere, restUpdate);
write.runOptions.many = true;
return write.execute();
});
}
}
let pushStatus = pushStatusHandler(config);
const pushStatus = pushStatusHandler(config);
return Promise.resolve().then(() => {
return pushStatus.setInitial(body, where);
}).then(() => {
@@ -105,7 +105,7 @@ export class PushController extends AdaptableController {
sendToAdapter(body, installations, pushStatus) {
if (body.data && body.data.badge && typeof body.data.badge == 'string' && body.data.badge.toLowerCase() == "increment") {
// Collect the badges to reduce the # of calls
let badgeInstallationsMap = installations.reduce((map, installation) => {
const badgeInstallationsMap = installations.reduce((map, installation) => {
let badge = installation.badge;
if (installation.deviceType != "ios") {
badge = UNSUPPORTED_BADGE_KEY;
@@ -116,8 +116,8 @@ export class PushController extends AdaptableController {
}, {});
// Map the on the badges count and return the send result
let promises = Object.keys(badgeInstallationsMap).map((badge) => {
let payload = deepcopy(body);
const promises = Object.keys(badgeInstallationsMap).map((badge) => {
const payload = deepcopy(body);
if (badge == UNSUPPORTED_BADGE_KEY) {
delete payload.data.badge;
} else {