feat(organizations): email inviter when membership invite is accepted

When a user accepts an org invite, send a notification email to the
person who sent the invite with membership details (member name, email,
org name, role) and an optional View Organization button.

Added build_invite_accepted_html() template to email_templates.py,
wired it into the accept_invite() handler, and added a test case.
This commit is contained in:
2026-04-26 18:36:58 +09:30
parent d48e6b2f97
commit 02e95a4199
3 changed files with 93 additions and 1 deletions
+21 -1
View File
@@ -148,8 +148,28 @@ def test_html_email():
success = provider.send(message)
print(f"Result: {'✅ SUCCESS' if success else '❌ FAILED'}")
# Test 8: Invite Accepted
print("\n--- Test 8: Invite Accepted ---")
html_body = email_templates.build_invite_accepted_html(
inviter_name="Admin User",
member_name="New Member",
member_email="newmember@example.com",
org_name="Acme Corporation",
role="Member",
org_link="https://secuird.tech/organizations/org-123",
)
message = EmailMessage(
to="cory@hawkvelt.id.au",
subject="New Member accepted your invitation to Acme Corporation",
body="Plain text version: New Member has accepted your invitation.",
html_body=html_body,
from_address="Secuird <noreply@secuird.tech>",
)
success = provider.send(message)
print(f"Result: {'✅ SUCCESS' if success else '❌ FAILED'}")
print("\n" + "=" * 50)
print("All 7 email templates sent!")
print("All 8 email templates sent!")
print("=" * 50)