Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: email notifications #3457

Merged
merged 30 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0e7a6e8
fix: email-template design
1akhanBaheti Jan 24, 2024
4ff1a45
fix: priority and state new value
NarayanBavisetti Jan 24, 2024
b0bcc69
dev: update template with comments, cta text and view issue button.
pablohashescobar Jan 24, 2024
7b95cb7
dev: fix priority and state
pablohashescobar Jan 24, 2024
cf00872
Merge branch 'fix/email-notifications' of github.com:makeplane/plane …
NarayanBavisetti Jan 24, 2024
bdc9acf
dev: update data condition
pablohashescobar Jan 24, 2024
2b0f83a
fix: added avatar url
NarayanBavisetti Jan 24, 2024
6bcb28d
Merge branch 'fix/email-notifications' of github.com:makeplane/plane …
NarayanBavisetti Jan 24, 2024
af15f9f
fix: comment avatar url
NarayanBavisetti Jan 24, 2024
6e11053
fix: priority, labels, state design
1akhanBaheti Jan 24, 2024
9bf5a30
style: assignee property
1akhanBaheti Jan 24, 2024
908882d
dev: fix template for comments and profile changes
pablohashescobar Jan 24, 2024
b073843
Merge branch 'fix/email-notifications' of github.com:makeplane/plane …
pablohashescobar Jan 24, 2024
5ea88c5
fix: spacing between properties
1akhanBaheti Jan 24, 2024
ccbaa17
Merge branch 'fix/email-notifications' of https://github.com/makeplan…
1akhanBaheti Jan 24, 2024
88595b5
fix: todo image for state change
NarayanBavisetti Jan 24, 2024
57cf47d
Merge branch 'fix/email-notifications' of github.com:makeplane/plane …
NarayanBavisetti Jan 24, 2024
d818796
fix: blocking and blocked by value change
NarayanBavisetti Jan 24, 2024
43241ae
dev: update template summsary
pablohashescobar Jan 24, 2024
f67074f
Merge branch 'fix/email-notifications' of github.com:makeplane/plane …
pablohashescobar Jan 24, 2024
9646026
fix: blocking, duplicate
1akhanBaheti Jan 24, 2024
30ddcc6
fix: comments spacing
1akhanBaheti Jan 24, 2024
b99d7e9
chore: improve `state change` checkbox logic.
prateekshourya29 Jan 24, 2024
c277db2
fix: email notification message change
NarayanBavisetti Jan 24, 2024
c7fc4c8
Merge branch 'fix/email-notifications' of github.com:makeplane/plane …
NarayanBavisetti Jan 24, 2024
e8b480a
fix: updated date format
NarayanBavisetti Jan 24, 2024
a1e77fc
fix: updates text color
1akhanBaheti Jan 24, 2024
179dcd3
fix: labels sequence rendering
1akhanBaheti Jan 24, 2024
b55ab94
fix: schedular time change
NarayanBavisetti Jan 24, 2024
5adb506
Merge branch 'fix/email-notifications' of github.com:makeplane/plane …
NarayanBavisetti Jan 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 19 additions & 26 deletions apiserver/plane/bgtasks/email_notification_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,30 +164,25 @@ def send_email_notification(
}
)
activity_time = changes.pop("activity_time")
template_data.append(
{
"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),
}
)
# Parse the input string into a datetime object
formatted_time = datetime.strptime(activity_time, "%Y-%m-%d %H:%M:%S").strftime("%H:%M %p")

span = f"""<span style='
font-size: 1rem;
font-weight: 700;
line-height: 28px;
"
>
{template_data[0]['actor_detail']['first_name']} {template_data[0]['actor_detail']['last_name']}
</span>"""
if changes:
template_data.append(
{
"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(formatted_time),
}
)

summary = "updates were made to the issue by"

Expand All @@ -204,11 +199,10 @@ def send_email_notification(
"receiver": {
"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",
"comments": comments,
}
print(json.dumps(context))
html_content = render_to_string(
"emails/notifications/issue-updates.html", context
)
Expand Down Expand Up @@ -236,7 +230,6 @@ def send_email_notification(
EmailNotificationLog.objects.filter(
pk__in=email_notification_ids
).update(sent_at=timezone.now())
print("Email Sent")
return
except Exception as e:
print(e)
Expand Down
6 changes: 5 additions & 1 deletion apiserver/plane/bgtasks/notification_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ def notifications(
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
if issue_activity.get("field") == "description":
continue
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"check-every-five-minutes-to-send-email-notifications": {
"task": "plane.bgtasks.email_notification_task.stack_email_notification",
"schedule": crontab(minute='*/1')
"schedule": crontab(minute='*/5')
},
}

Expand Down
Loading
Loading