mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
setting for emailNotificationsChatMessage
This commit is contained in:
parent
ad96e08e68
commit
574da51327
@ -1,4 +1,4 @@
|
||||
import { getDriver } from '../../db/neo4j'
|
||||
import { getDriver } from '../neo4j'
|
||||
|
||||
export const description =
|
||||
'Transforms the `sendNotificationEmails` property on User to a multi value system'
|
||||
@ -14,6 +14,7 @@ export async function up(next) {
|
||||
MATCH (user:User)
|
||||
SET user.emailNotificationsCommentOnObservedPost = user.sendNotificationEmails
|
||||
SET user.emailNotificationsMention = user.sendNotificationEmails
|
||||
SET user.emailNotificationsChatMessage = user.sendNotificationEmails
|
||||
SET user.emailNotificationsGroupMemberJoined = user.sendNotificationEmails
|
||||
SET user.emailNotificationsGroupMemberLeft = user.sendNotificationEmails
|
||||
SET user.emailNotificationsGroupMemberRemoved = user.sendNotificationEmails
|
||||
@ -46,6 +47,7 @@ export async function down(next) {
|
||||
SET user.sendNotificationEmails = true
|
||||
REMOVE user.emailNotificationsCommentOnObservedPost
|
||||
REMOVE user.emailNotificationsMention
|
||||
REMOVE user.emailNotificationsChatMessage
|
||||
REMOVE user.emailNotificationsGroupMemberJoined
|
||||
REMOVE user.emailNotificationsGroupMemberLeft
|
||||
REMOVE user.emailNotificationsGroupMemberRemoved
|
||||
|
||||
@ -44,7 +44,6 @@ const publishNotifications = async (context, promises, emailNotificationSetting:
|
||||
notifications.forEach((notificationAdded, index) => {
|
||||
pubsub.publish(NOTIFICATION_ADDED, { notificationAdded })
|
||||
if (notificationAdded.to[emailNotificationSetting] ?? true) {
|
||||
// Default to true
|
||||
sendMail(
|
||||
notificationTemplate({
|
||||
email: notificationsEmailAddresses[index].email,
|
||||
@ -356,7 +355,7 @@ const handleCreateMessage = async (resolve, root, args, context, resolveInfo) =>
|
||||
MATCH (room)<-[:CHATS_IN]-(recipientUser:User)-[:PRIMARY_EMAIL]->(emailAddress:EmailAddress)
|
||||
WHERE NOT recipientUser.id = $currentUserId
|
||||
AND NOT (recipientUser)-[:BLOCKED]-(currentUser)
|
||||
AND recipientUser.sendNotificationEmails = true
|
||||
AND NOT recipientUser.emailNotificationsChatMessage = false
|
||||
RETURN recipientUser, emailAddress {.email}
|
||||
`
|
||||
const txResponse = await transaction.run(messageRecipientCypher, {
|
||||
|
||||
@ -165,6 +165,10 @@ export default {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
emailNotificationsChatMessage: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
emailNotificationsGroupMemberJoined: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
|
||||
@ -676,6 +676,15 @@ describe('emailNotificationSettings', () => {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'chat',
|
||||
settings: [
|
||||
{
|
||||
name: 'chatMessage',
|
||||
value: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'group',
|
||||
settings: [
|
||||
|
||||
@ -160,8 +160,7 @@ export default {
|
||||
const allowedSettingNames = [
|
||||
'commentOnObservedPost',
|
||||
'mention',
|
||||
'postByFollowedUser',
|
||||
'postInGroup',
|
||||
'chatMessage',
|
||||
'groupMemberJoined',
|
||||
'groupMemberLeft',
|
||||
'groupMemberRemoved',
|
||||
@ -396,6 +395,15 @@ export default {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'chat',
|
||||
settings: [
|
||||
{
|
||||
name: 'chatMessage',
|
||||
value: parent.emailNotificationsChatMessage ?? true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'group',
|
||||
settings: [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user