mirror of
https://github.com/janoodleFTW/timy-messenger.git
synced 2026-08-01 15:30:00 +00:00
17 lines
587 B
JavaScript
17 lines
587 B
JavaScript
const functions = require('firebase-functions');
|
|
const sendPushForNewReaction = require('./reaction-push');
|
|
|
|
const updatedMessages = functions
|
|
.region('europe-west1')
|
|
.firestore
|
|
.document('/groups/{groupId}/channels/{channelId}/messages/{messageId}')
|
|
.onUpdate(async (change, context) => {
|
|
const messageBefore = change.before.data();
|
|
const messageAfter = change.after.data();
|
|
const authorUid = messageAfter.author;
|
|
|
|
await sendPushForNewReaction(messageBefore, messageAfter, authorUid, context);
|
|
|
|
});
|
|
|
|
module.exports = updatedMessages;
|