diff --git a/website/common/locales/en/quests.json b/website/common/locales/en/quests.json index 4103252374..e863a9750d 100644 --- a/website/common/locales/en/quests.json +++ b/website/common/locales/en/quests.json @@ -25,7 +25,7 @@ "inviteParty": "Invite Party to Quest", "questInvitation": "Quest Invitation: ", "questInvitationTitle": "Quest Invitation", - "questInvitationInfo": "Invitation for the Quest <%= quest %>", + "questInvitationNotificationInfo": "You were invited to join a quest", "invitedToQuest": "You were invited to the Quest <%= quest %>", "askLater": "Ask Later", "questLater": "Quest Later", diff --git a/website/common/locales/en/settings.json b/website/common/locales/en/settings.json index 07a57a5cb1..4790f09773 100644 --- a/website/common/locales/en/settings.json +++ b/website/common/locales/en/settings.json @@ -111,7 +111,7 @@ "emailNotifications": "Email Notifications", "wonChallenge": "You won a Challenge!", "newPM": "Received Private Message", - "newPMInfo": "New Message from <%= name %>: <%= message %>", + "newPMNotificationTitle": "New Message from <%= name %>", "giftedGems": "Gifted Gems", "giftedGemsInfo": "<%= name %> gifted you <%= amount %> Gems", "giftedGemsFull": "Hello <%= username %>, <%= sender %> has sent you <%= gemAmount %> gems!", @@ -119,8 +119,8 @@ "giftedSubscriptionInfo": "<%= name %> gifted you a <%= months %> month subscription", "giftedSubscriptionFull": "Hello <%= username %>, <%= sender %> has sent you <%= monthCount %> months of subscription!", "giftedSubscriptionWinterPromo": "Hello <%= username %>, you received <%= monthCount %> months of subscription as part of our holiday gift-giving promotion!", - "invitedParty": "Invited To Party", - "invitedGuild": "Invited To Guild", + "invitedParty": "You were invited to a Party", + "invitedGuild": "You were invited to a Guild", "importantAnnouncements": "Reminders to check in to complete tasks and receive prizes", "weeklyRecaps": "Summaries of your account activity in the past week (Note: this is currently disabled due to performance issues, but we hope to have this back up and sending e-mails again soon!)", "onboarding": "Guidance with setting up your Habitica account", diff --git a/website/server/controllers/api-v3/quests.js b/website/server/controllers/api-v3/quests.js index 4153244620..f43b5f7f6b 100644 --- a/website/server/controllers/api-v3/quests.js +++ b/website/server/controllers/api-v3/quests.js @@ -124,8 +124,8 @@ api.inviteToQuest = { sendPushNotification( member, { - title: res.t('questInvitationTitle', member.preferences.language), - message: res.t('questInvitationInfo', {quest: quest.text(member.preferences.language)}, member.preferences.language), + title: quest.text(member.preferences.language), + message: res.t('questInvitationNotificationInfo', member.preferences.language), identifier: 'questInvitation', category: 'questInvitation', } diff --git a/website/server/libs/inbox/index.js b/website/server/libs/inbox/index.js index c51fa9e67e..44a773140d 100644 --- a/website/server/libs/inbox/index.js +++ b/website/server/libs/inbox/index.js @@ -17,8 +17,8 @@ export async function sentMessage (sender, receiver, message, translate) { sendPushNotification( receiver, { - title: translate('newPM', receiver.preferences.language), - message: translate('newPMInfo', {name: getUserInfo(sender, ['name']).name, message}, receiver.preferences.language), + title: translate('newPMNotificationTitle', {name: getUserInfo(sender, ['name']).name}, receiver.preferences.language), + message, identifier: 'newPM', category: 'newPM', payload: {replyTo: sender._id}, diff --git a/website/server/libs/pushNotifications.js b/website/server/libs/pushNotifications.js index 4cd4a1d82f..dd15e470b8 100644 --- a/website/server/libs/pushNotifications.js +++ b/website/server/libs/pushNotifications.js @@ -19,7 +19,7 @@ if (APN_ENABLED) { keyId: nconf.get('PUSH_CONFIGS_APN_KEY_ID'), teamId: nconf.get('PUSH_CONFIGS_APN_TEAM_ID'), }, - production: nconf.get('IS_PROD'), + production: true, }) : undefined; } @@ -56,7 +56,9 @@ function sendNotification (user, details = {}) { case 'ios': if (apnProvider) { const notification = new apn.Notification({ - alert: details.message, + alert: {title: details.title, + body: details.message, + }, sound: 'default', category: details.category, topic: 'com.habitrpg.ios.Habitica', diff --git a/website/server/models/group.js b/website/server/models/group.js index 9b840fc895..20c992d360 100644 --- a/website/server/models/group.js +++ b/website/server/models/group.js @@ -699,7 +699,7 @@ schema.methods.startQuest = async function startQuest (user) { const memberLang = member.preferences.language; sendPushNotification(member, { title: quest.text(memberLang), - message: `${shared.i18n.t('questStarted', memberLang)}: ${quest.text(memberLang)}`, + message: shared.i18n.t('questStarted', memberLang), identifier: 'questStarted', }); }