Skip to content

tenants: invitation emails are never sent (InvitationCreated has no subscriber) #496

Closed

Description

@antosubash

Tier 1: correctness

Problem

modules/tenants/tenants/invitations.py:101 publishes InvitationCreated(..., accept_url). The module docstring says it does so "for a mailer module to send", and docs/modules/tenants.md:70,88 says the same. Nothing in the repo subscribes to the event: a grep for InvitationCreated finds only the publisher, the event class, and a comment in endpoints/api.py:145.

As a result, an invitation reaches nobody unless the admin copies accept_url from the API response and sends it themselves. Either the docs or the behaviour has to change.

Root cause

The only mailer lives inside users (users/mailer/__init__.py). Its interface has fixed methods for the user flows, so another module can't reuse it.

Fix

  • Move the mailer out of users into core, or into a small mail module, with a generic send(template, to, context).
  • Subscribe it to InvitationCreated.
  • Until then, make the invite UI say clearly that the link has to be shared by hand, and correct docs/modules/tenants.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions