@@ -76,7 +76,7 @@ export class PushWorker {
|
||||
installations,
|
||||
locales
|
||||
);
|
||||
const promises = Object.keys(grouppedInstallations).map((locale) => {
|
||||
const promises = Object.keys(grouppedInstallations).map(locale => {
|
||||
const installations = grouppedInstallations[locale];
|
||||
const body = bodiesPerLocales[locale];
|
||||
return this.sendToAdapter(
|
||||
@@ -94,7 +94,7 @@ export class PushWorker {
|
||||
logger.verbose(`Sending push to ${installations.length}`);
|
||||
return this.adapter
|
||||
.send(body, installations, pushStatus.objectId)
|
||||
.then((results) => {
|
||||
.then(results => {
|
||||
return pushStatus.trackSent(results, UTCOffset).then(() => results);
|
||||
});
|
||||
}
|
||||
@@ -103,7 +103,7 @@ export class PushWorker {
|
||||
const badgeInstallationsMap = groupByBadge(installations);
|
||||
|
||||
// Map the on the badges count and return the send result
|
||||
const promises = Object.keys(badgeInstallationsMap).map((badge) => {
|
||||
const promises = Object.keys(badgeInstallationsMap).map(badge => {
|
||||
const payload = deepcopy(body);
|
||||
payload.data.badge = parseInt(badge);
|
||||
const installations = badgeInstallationsMap[badge];
|
||||
|
||||
@@ -29,7 +29,7 @@ export function getLocalesFromPush(body) {
|
||||
return [
|
||||
...new Set(
|
||||
Object.keys(data).reduce((memo, key) => {
|
||||
localizableKeys.forEach((localizableKey) => {
|
||||
localizableKeys.forEach(localizableKey => {
|
||||
if (key.indexOf(`${localizableKey}-`) == 0) {
|
||||
memo.push(key.slice(localizableKey.length + 1));
|
||||
}
|
||||
@@ -46,7 +46,7 @@ export function transformPushBodyForLocale(body, locale) {
|
||||
return body;
|
||||
}
|
||||
body = deepcopy(body);
|
||||
localizableKeys.forEach((key) => {
|
||||
localizableKeys.forEach(key => {
|
||||
const localeValue = body.data[`${key}-${locale}`];
|
||||
if (localeValue) {
|
||||
body.data[key] = localeValue;
|
||||
@@ -59,8 +59,8 @@ export function stripLocalesFromBody(body) {
|
||||
if (!body.data) {
|
||||
return body;
|
||||
}
|
||||
Object.keys(body.data).forEach((key) => {
|
||||
localizableKeys.forEach((localizableKey) => {
|
||||
Object.keys(body.data).forEach(key => {
|
||||
localizableKeys.forEach(localizableKey => {
|
||||
if (key.indexOf(`${localizableKey}-`) == 0) {
|
||||
delete body.data[key];
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export function groupByLocaleIdentifier(installations, locales = []) {
|
||||
return installations.reduce(
|
||||
(map, installation) => {
|
||||
let added = false;
|
||||
locales.forEach((locale) => {
|
||||
locales.forEach(locale => {
|
||||
if (added) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user