A Synapse module used by Tchap to derive a display name from a new user's email address.
  • Python 95.8%
  • Shell 4.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Brendan Abolivier 7c2e660299
Fix copyright
This code lives on vector-im, and does therefore belong to New Vector Ltd, not to the Matrix.org Foundation
2022-04-07 14:04:22 +01:00
.github Fix code owners 2022-02-16 17:32:38 +00:00
scripts-dev Fix configs 2022-02-21 11:58:21 +00:00
tchap_displayname_email Fix copyright 2022-04-07 14:04:22 +01:00
tests Fix copyright 2022-04-07 14:04:22 +01:00
.gitignore Cookiecutter generation 2022-02-16 16:54:27 +00:00
.gitlab-ci.yml Cookiecutter generation 2022-02-16 16:54:27 +00:00
LICENSE Cookiecutter generation 2022-02-16 16:54:27 +00:00
mypy.ini Cookiecutter generation 2022-02-16 16:54:27 +00:00
pyproject.toml Fix configs 2022-02-21 11:58:21 +00:00
README.md Fix typos: username -> display name 2022-02-21 11:56:37 +00:00
setup.cfg Fix configs 2022-02-21 11:58:21 +00:00
tox.ini Fix configs 2022-02-21 11:58:21 +00:00

Tchap display name generator

A Synapse module used by Tchap to derive a display name from a new user's email address.

Installation

From the virtual environment that you use for Synapse, install this module with:

pip install path/to/tchap-displayname-from-email

(If you run into issues, you may need to upgrade pip first, e.g. by running pip install --upgrade pip)

Then alter your homeserver configuration, adding to your modules configuration:

modules:
  - module: tchap_displayname_email.TchapDisplaynameEmail
    config:
      # Whether to try to extract full name and organisation from the email address. The
      # resulting display name will have the form "John Doe [Acme]".
      # Optional, defaults to "true".
      extract_from_email: true

Development

In a virtual environment with pip ≥ 21.1, run

pip install -e .[dev]

To run the unit tests, you can either use:

tox -e py

or

trial tests

To run the linters and mypy type checker, use ./scripts-dev/lint.sh.

Releasing

The exact steps for releasing will vary; but this is an approach taken by the Synapse developers (assuming a Unix-like shell):

  1. Set a shell variable to the version you are releasing (this just makes subsequent steps easier):

    version=X.Y.Z
    
  2. Update setup.cfg so that the version is correct.

  3. Stage the changed files and commit.

    git add -u
    git commit -m v$version -n
    
  4. Push your changes.

    git push
    
  5. When ready, create a signed tag for the release:

    git tag -s v$version
    

    Base the tag message on the changelog.

  6. Push the tag.

    git push origin tag v$version