tweak email template model, fix EventLog content size, etc...

This commit is contained in:
Dobromir Popov
2024-04-19 17:04:25 +03:00
parent 54472ad8f2
commit 02c0c420b5
5 changed files with 8 additions and 7 deletions

View File

@ -279,8 +279,8 @@ export default async function handler(req, res) {
let pubsToSend = subscribedPublishers.concat(availablePublishers).
filter((item, index, self) =>
index === self.findIndex((t) => (
t.email === item.email //and exclude the user himself
)) //&& item.email !== publisher.email
t.email === item.email && item.email !== publisher.email//and exclude the user himself
))
);
console.log("Sending CoverMe request to " + pubsToSend.length + " publishers");
@ -294,17 +294,18 @@ export default async function handler(req, res) {
+ "до: " + pubsToSend.map(p => p.firstName + " " + p.lastName + "<" + p.email + ">").join(", "),
}
});
//send email to all subscribed publishers
for (let i = 0; i < pubsToSend.length; i++) {
//send email to subscribed publisher
let acceptUrl = process.env.NEXTAUTH_URL + "/api/email?action=email_response&emailaction=coverMeAccept&userId=" + pubsToSend[i].id + "&shiftId=" + assignment.shiftId + "&assignmentPID=" + newPublicGuid;
publisher.prefix = publisher.isMale ? "Брат" : "Сестра";
let model = {
user: publisher,
shiftId: assignment.shiftId,
acceptUrl: acceptUrl,
prefix: publisher.isMale ? "Брат" : "Сестра",
firstName: pubsToSend[i].firstName,
lastName: pubsToSend[i].lastName,
email: pubsToSend[i].email,