Skip to content

Commit ccd7558

Browse files
hgwoodErrorname
authored andcommitted
✨ disable answer email notification if the answerer is the asker (#238)
1 parent 6f28755 commit ccd7558

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

server/src/resolvers/answer.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,18 @@ module.exports = {
3131
`
3232
{
3333
id
34+
user {
35+
id
36+
}
3437
node {
3538
flags(where:{type:"unanswered"}) {
3639
id
3740
}
41+
question {
42+
user {
43+
id
44+
}
45+
}
3846
}
3947
}
4048
`
@@ -67,7 +75,12 @@ module.exports = {
6775
})
6876

6977
algolia.updateNode(ctx, nodeId)
70-
mailgun.sendNewAnswer(ctx, nodeId)
78+
79+
// Let's notify the user who asked the question, but only if they did not answer the
80+
// question them-selves.
81+
if (answer.node.question.user.id !== answer.user.id) {
82+
mailgun.sendNewAnswer(ctx, nodeId)
83+
}
7184

7285
return ctx.prisma.query.answer(
7386
{

0 commit comments

Comments
 (0)