forked from github/plane
fix: email notifications (#3457)
* fix: email-template design * fix: priority and state new value * dev: update template with comments, cta text and view issue button. * dev: fix priority and state * dev: update data condition * fix: added avatar url * fix: comment avatar url * fix: priority, labels, state design * style: assignee property * dev: fix template for comments and profile changes * fix: spacing between properties * fix: todo image for state change * fix: blocking and blocked by value change * dev: update template summsary * fix: blocking, duplicate * fix: comments spacing * chore: improve `state change` checkbox logic. * fix: email notification message change * fix: updated date format * fix: updates text color * fix: labels sequence rendering * fix: schedular time change --------- Co-authored-by: LAKHAN BAHETI <lakhanbaheti9@gmail.com> Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
This commit is contained in:
parent
b66f07845a
commit
adf091fa07
@ -164,30 +164,25 @@ def send_email_notification(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
activity_time = changes.pop("activity_time")
|
activity_time = changes.pop("activity_time")
|
||||||
template_data.append(
|
# Parse the input string into a datetime object
|
||||||
{
|
formatted_time = datetime.strptime(activity_time, "%Y-%m-%d %H:%M:%S").strftime("%H:%M %p")
|
||||||
"actor_detail": {
|
|
||||||
"avatar_url": actor.avatar,
|
|
||||||
"first_name": actor.first_name,
|
|
||||||
"last_name": actor.last_name,
|
|
||||||
},
|
|
||||||
"changes": changes,
|
|
||||||
"issue_details": {
|
|
||||||
"name": issue.name,
|
|
||||||
"identifier": f"{issue.project.identifier}-{issue.sequence_id}",
|
|
||||||
},
|
|
||||||
"activity_time": str(activity_time),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
span = f"""<span style='
|
if changes:
|
||||||
font-size: 1rem;
|
template_data.append(
|
||||||
font-weight: 700;
|
{
|
||||||
line-height: 28px;
|
"actor_detail": {
|
||||||
"
|
"avatar_url": actor.avatar,
|
||||||
>
|
"first_name": actor.first_name,
|
||||||
{template_data[0]['actor_detail']['first_name']} {template_data[0]['actor_detail']['last_name']}
|
"last_name": actor.last_name,
|
||||||
</span>"""
|
},
|
||||||
|
"changes": changes,
|
||||||
|
"issue_details": {
|
||||||
|
"name": issue.name,
|
||||||
|
"identifier": f"{issue.project.identifier}-{issue.sequence_id}",
|
||||||
|
},
|
||||||
|
"activity_time": str(formatted_time),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
summary = "updates were made to the issue by"
|
summary = "updates were made to the issue by"
|
||||||
|
|
||||||
@ -204,11 +199,10 @@ def send_email_notification(
|
|||||||
"receiver": {
|
"receiver": {
|
||||||
"email": receiver.email,
|
"email": receiver.email,
|
||||||
},
|
},
|
||||||
"issue_unsubscribe": f"{base_api}/{str(issue.project.workspace.slug)}/projects/{str(issue.project.id)}/issues/{str(issue.id)}",
|
"issue_url": f"{base_api}/{str(issue.project.workspace.slug)}/projects/{str(issue.project.id)}/issues/{str(issue.id)}",
|
||||||
"user_preference": f"{base_api}/profile/preferences/email",
|
"user_preference": f"{base_api}/profile/preferences/email",
|
||||||
"comments": comments,
|
"comments": comments,
|
||||||
}
|
}
|
||||||
print(json.dumps(context))
|
|
||||||
html_content = render_to_string(
|
html_content = render_to_string(
|
||||||
"emails/notifications/issue-updates.html", context
|
"emails/notifications/issue-updates.html", context
|
||||||
)
|
)
|
||||||
@ -236,7 +230,6 @@ def send_email_notification(
|
|||||||
EmailNotificationLog.objects.filter(
|
EmailNotificationLog.objects.filter(
|
||||||
pk__in=email_notification_ids
|
pk__in=email_notification_ids
|
||||||
).update(sent_at=timezone.now())
|
).update(sent_at=timezone.now())
|
||||||
print("Email Sent")
|
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
@ -334,7 +334,11 @@ def notifications(
|
|||||||
user_id=subscriber
|
user_id=subscriber
|
||||||
)
|
)
|
||||||
|
|
||||||
for issue_activity in issue_activities_created:
|
for issue_activity in issue_activities_created:
|
||||||
|
# If activity done in blocking then blocked by email should not go
|
||||||
|
if issue_activity.get("issue_detail").get("id") != issue_id:
|
||||||
|
continue;
|
||||||
|
|
||||||
# Do not send notification for description update
|
# Do not send notification for description update
|
||||||
if issue_activity.get("field") == "description":
|
if issue_activity.get("field") == "description":
|
||||||
continue
|
continue
|
||||||
|
@ -31,7 +31,7 @@ app.conf.beat_schedule = {
|
|||||||
},
|
},
|
||||||
"check-every-five-minutes-to-send-email-notifications": {
|
"check-every-five-minutes-to-send-email-notifications": {
|
||||||
"task": "plane.bgtasks.email_notification_task.stack_email_notification",
|
"task": "plane.bgtasks.email_notification_task.stack_email_notification",
|
||||||
"schedule": crontab(minute='*/1')
|
"schedule": crontab(minute='*/5')
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -104,7 +104,7 @@ export const EmailNotificationForm: FC<IEmailNotificationFormProps> = (props) =>
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={value}
|
checked={value}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
if (!value) setValue("issue_completed", true);
|
setValue("issue_completed", !value);
|
||||||
onChange(!value);
|
onChange(!value);
|
||||||
}}
|
}}
|
||||||
className="w-3.5 h-3.5 mx-2 cursor-pointer"
|
className="w-3.5 h-3.5 mx-2 cursor-pointer"
|
||||||
|
Loading…
Reference in New Issue
Block a user