This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -1291,7 +1291,14 @@ export const NOTIFICATIONS = [
1291
1291
type : NOTIFICATION_TYPE . TAAS ,
1292
1292
rules : [
1293
1293
{
1294
- text : "{{numOfExpiringResourceBookings}} resource booking{{s}} {{be}} expiring in the team <strong>{{teamName}}</strong>" ,
1294
+ textIsPlural : true ,
1295
+ text : "{{numOfExpiringResourceBookings}} resource bookings are expiring in the team <strong>{{teamName}}</strong>" ,
1296
+ shouldBundle : false ,
1297
+ goTo : GOTO . TAAS_PROJECT ,
1298
+ } ,
1299
+ {
1300
+ textIsPlural : false ,
1301
+ text : "{{numOfExpiringResourceBookings}} resource booking is expiring in the team <strong>{{teamName}}</strong>" ,
1295
1302
shouldBundle : false ,
1296
1303
goTo : GOTO . TAAS_PROJECT ,
1297
1304
} ,
Original file line number Diff line number Diff line change @@ -319,6 +319,12 @@ const getNotificationRule = (notification) => {
319
319
) ;
320
320
}
321
321
322
+ if ( notification . contents . textIsPlural != null ) {
323
+ match =
324
+ match &&
325
+ notification . contents . textIsPlural === _notificationRule . textIsPlural ;
326
+ }
327
+
322
328
return match ;
323
329
} ) ;
324
330
@@ -572,6 +578,17 @@ export const preRenderNotifications = (notifications) => {
572
578
573
579
// --- TaaS --- //
574
580
581
+ const prepareTaaSNotificationContents = ( eventType , contents ) => {
582
+ if ( eventType === EVENT_TYPE . TAAS . RESOURCE_BOOKING_EXPIRATION ) {
583
+ return {
584
+ ...contents ,
585
+ textIsPlural : contents . numOfExpiringResourceBookings > 1 ,
586
+ } ;
587
+ }
588
+
589
+ return contents ;
590
+ } ;
591
+
575
592
export const prepareTaaSNotifications = ( rawNotifications ) => {
576
593
const notifications = rawNotifications . map ( ( rawNotification ) => ( {
577
594
id : `${ rawNotification . id } ` ,
@@ -585,7 +602,10 @@ export const prepareTaaSNotifications = (rawNotifications) => {
585
602
date : rawNotification . createdAt ,
586
603
isRead : rawNotification . read ,
587
604
seen : rawNotification . seen ,
588
- contents : rawNotification . contents ,
605
+ contents : prepareTaaSNotificationContents (
606
+ rawNotification . type ,
607
+ rawNotification . contents
608
+ ) ,
589
609
version : rawNotification . version ,
590
610
} ) ) ;
591
611
You can’t perform that action at this time.
0 commit comments