mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
prevent email notifications for blocked users
comment
This commit is contained in:
parent
2bd21b8be3
commit
cf059cd9d4
@ -321,6 +321,7 @@ const handleCreateMessage = async (resolve, root, args, context, resolveInfo) =>
|
||||
MATCH (currentUser:User { id: $currentUserId })-[:CHATS_IN]->(room:Room { id: $roomId })
|
||||
MATCH (room)<-[:CHATS_IN]-(recipientUser:User)-[:PRIMARY_EMAIL]->(emailAddress:EmailAddress)
|
||||
WHERE NOT recipientUser.id = $currentUserId
|
||||
AND NOT (recipientUser)-[:BLOCKED]-(currentUser)
|
||||
RETURN recipientUser, emailAddress {.email}
|
||||
`
|
||||
const txResponse = await transaction.run(messageRecipientCypher, {
|
||||
@ -338,8 +339,8 @@ const handleCreateMessage = async (resolve, root, args, context, resolveInfo) =>
|
||||
// Execute Query
|
||||
const { user, email } = await messageRecipient
|
||||
|
||||
// Send EMail if not considered online
|
||||
if (!isUserOnline(user)) {
|
||||
// Send EMail if we found a user(not blocked) and he is not considered online
|
||||
if (user && !isUserOnline(user)) {
|
||||
void sendMail(chatMessageTemplate({ email, variables: { name: user.properties.name } }))
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user