notification-issue #72
@ -9,8 +9,6 @@ const logger = getLogger();
|
|||||||
interface NotificationData {
|
interface NotificationData {
|
||||||
senderId?: string;
|
senderId?: string;
|
||||||
recipientId?: string;
|
recipientId?: string;
|
||||||
ownerId?: string;
|
|
||||||
trainerId?: string;
|
|
||||||
type?: string;
|
type?: string;
|
||||||
notificationSent?: boolean;
|
notificationSent?: boolean;
|
||||||
timestamp?: admin.firestore.FieldValue;
|
timestamp?: admin.firestore.FieldValue;
|
||||||
@ -84,14 +82,6 @@ async function getUserAndFCMToken(
|
|||||||
if (notification.recipientId) {
|
if (notification.recipientId) {
|
||||||
targetUserId = notification.recipientId;
|
targetUserId = notification.recipientId;
|
||||||
logger.info(`Using top-level recipientId: ${targetUserId}`);
|
logger.info(`Using top-level recipientId: ${targetUserId}`);
|
||||||
} else if (notification.ownerId) {
|
|
||||||
targetUserId = notification.ownerId;
|
|
||||||
logger.info(`Using top-level ownerId: ${targetUserId}`);
|
|
||||||
|
|
||||||
} else if (notification.trainerId) {
|
|
||||||
targetUserId = notification.trainerId;
|
|
||||||
logger.info(`Using top-level trainerId: ${targetUserId}`);
|
|
||||||
|
|
||||||
} else if (notification.data?.userId) {
|
} else if (notification.data?.userId) {
|
||||||
targetUserId = notification.data.userId;
|
targetUserId = notification.data.userId;
|
||||||
logger.info(`Using data.userId: ${targetUserId}`);
|
logger.info(`Using data.userId: ${targetUserId}`);
|
||||||
@ -171,8 +161,6 @@ function prepareNotificationMessage(
|
|||||||
|
|
||||||
if (notification.senderId) fcmData.senderId = notification.senderId;
|
if (notification.senderId) fcmData.senderId = notification.senderId;
|
||||||
if (notification.recipientId) fcmData.recipientId = notification.recipientId;
|
if (notification.recipientId) fcmData.recipientId = notification.recipientId;
|
||||||
if (notification.ownerId) fcmData.ownerId = notification.ownerId;
|
|
||||||
if (notification.trainerId) fcmData.trainerId = notification.trainerId;
|
|
||||||
if (notification.read !== undefined) fcmData.read = String(notification.read);
|
if (notification.read !== undefined) fcmData.read = String(notification.read);
|
||||||
|
|
||||||
if (notification.data) {
|
if (notification.data) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user