Skip to content

Commit fe4520d

Browse files
committed
Fix logic
1 parent 64d4a82 commit fe4520d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

howtos/how-to-set-an-away-message/server.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ app.post("/talkjs", async (req, res) => {
5757
const role = data.sender?.role;
5858
const date = new Date(data.message.createdAt);
5959

60-
if (isOutOfHours(date) && role === "customer") {
61-
if (!(conversationId in alreadyReplied)) {
62-
await sendReply(conversationId);
63-
}
60+
if (
61+
isOutOfHours(date) &&
62+
role === "customer" &&
63+
!(conversationId in alreadyReplied)
64+
) {
65+
await sendReply(conversationId);
6466
alreadyReplied[conversationId] = new Date();
6567
}
6668

0 commit comments

Comments
 (0)