Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let notifyUser = null
if (snapValues.authorUid !== receiverUid) {
const payload = {
notification: {
title: `${snapValues.authorName} `,
body: lastMessage,
icon: snapValues.authorPhotoUrl
? snapValues.authorPhotoUrl
: '/apple-touch-icon.png',
click_action: `https://www.react-most-wanted.com/chats/edit/${senderUid}`,
tag: `chat`,
},
}
notifyUser = notifications.notifyUser(receiverUid, payload).then(() => {
return senderChatMessageRef
.update({
isReceived: context.timestamp,
})
.then(() => {
return senderChatRef.update({
isReceived: context.timestamp,
})
})
})
}
return Promise.all([
udateReceiverChatMessage,
udateSenderChat,
udateReceiverChat,
export default async function(object) {
const thumbnail = await createThumbnail(object)
if (thumbnail) {
const { fileDir, downloadURL } = thumbnail
await admin
.database()
.ref(fileDir)
.update({ thumbnail: downloadURL })
}
return
}
export default database.ref('/users_count').onDelete((data, context) => {
const getDBUsers = admin
.database()
.ref('users')
.once('value')
const getAuthUsers = usersUtil.listAllUsers()
return Promise.all([getDBUsers, getAuthUsers]).then(resulsts => {
const dbUsers = resulsts[0]
const authUsers = resulsts[1]
let promises = []
let userUids = []
let providerCount = {}
let usersPublicData = {}
let usersNotificationTokens = {}
authUsers.forEach(userRecord => {
const user = userRecord.toJSON()
let userPublicProviderData = {}
const creationTime = moment(user.metadata.creationTime)