Skip to content

Commit 422a009

Browse files
committed
nits
1 parent 7fdaf6e commit 422a009

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ With this configuration, user1 will have read only access to `myAppId1` and read
361361

362362
## Configuring Localized Push Notifications
363363

364-
With the latest version of the dashboard, it is possible to send localized messages for push notifications.
364+
With the latest version of the [dashboard](https://www.npmjs.com/package/parse-dashboard), it is possible to send localized messages for push notifications.
365365
You can provide a list of locales or languages you want to support for your dashboard users.
366366

367367
```json

src/dashboard/Push/PushNew.react.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,7 @@ export default class PushNew extends DashboardView {
160160
const available = this.context.currentApp.isLocalizationAvailable();
161161
if (available) {
162162
const locales = this.context.currentApp.fetchPushLocales();
163-
let filteredLocales = locales.filter((locale) => {
164-
if (locale === '' || locale === undefined) {
165-
return false;
166-
}
167-
return true;
168-
});
163+
const filteredLocales = locales.filter((locale) => !(locale === '' || locale === undefined));
169164
this.setState({
170165
isLocalizationAvailable: true,
171166
locales: filteredLocales,
@@ -199,6 +194,8 @@ export default class PushNew extends DashboardView {
199194

200195
// Gather the translations, and inject into the payload
201196
Object.keys(changes).forEach((key) => {
197+
// translations are stored as `tranlation[lang]` strings as keys,
198+
// this is why we slice it this way
202199
if (key.indexOf('translation[') === 0) {
203200
const locale = key.slice(12, key.length - 1);
204201
payload[`alert-${locale}`] = changes[key];

src/lib/ParseApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export default class ParseApp {
406406
}
407407

408408
isLocalizationAvailable() {
409-
return this.serverInfo.features.push.localization === true;
409+
return !!this.serverInfo.features.push.localization;
410410
}
411411

412412
fetchPushLocales() {

0 commit comments

Comments
 (0)