From d5c26c391469a979f0d83158edceab5f11d9c2ce Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Mon, 30 Aug 2021 21:08:04 +0200 Subject: [PATCH] =?UTF-8?q?V=20e-mailov=C3=BDch=20notifikac=C3=ADch=20uv?= =?UTF-8?q?=C3=A1d=C3=ADme=20i=20URL=20seznamu=20=C3=BA=C4=8Dastn=C3=ADk?= =?UTF-8?q?=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mo/email.py | 11 +++++++++++ mo/web/org_contest.py | 1 + 2 files changed, 12 insertions(+) diff --git a/mo/email.py b/mo/email.py index 812a7639..972918a2 100644 --- a/mo/email.py +++ b/mo/email.py @@ -73,6 +73,13 @@ def confirm_url(type: str, token: str) -> str: return config.WEB_ROOT + f'auth/confirm/{type}?' + urllib.parse.urlencode({'token': token}, safe=':') +def contestant_list_url(contest: db.Contest, registered_only: bool) -> str: + url = config.WEB_ROOT + f'org/contest/c/{contest.contest_id}/ucastnici' + if registered_only: + url += '?participation_state=registered' + return url + + def send_new_account_email(user: db.User, token: str) -> bool: return send_user_email(user, 'Založen nový účet', textwrap.dedent('''\ Vítejte! @@ -127,8 +134,10 @@ def send_join_notify_email(dest: db.User, who: db.User, contest: db.Contest) -> place = contest.place if contest.round.enroll_mode == db.RoundEnrollMode.confirm: confirm = 'Přihlášku je potřeba potvrdit v seznamu účastníků soutěže.' + url = 'Přihlášky k potvrzení: ' + contestant_list_url(contest, True) else: confirm = 'Přihláška byla schválena automaticky.' + url = 'Seznam účastníků: ' + contestant_list_url(contest, False) return send_user_email(dest, f'Nový účastník kategorie {round.category}', textwrap.dedent(f'''\ Nový účastník se přihlásil do MO v oblasti, kterou garantujete. @@ -141,5 +150,7 @@ def send_join_notify_email(dest: db.User, who: db.User, contest: db.Contest) -> {confirm} + {url} + Váš OSMO ''')) diff --git a/mo/web/org_contest.py b/mo/web/org_contest.py index 03e23ada..9b99ac9a 100644 --- a/mo/web/org_contest.py +++ b/mo/web/org_contest.py @@ -442,6 +442,7 @@ def org_contest_import(id: int): ) +# URL je explicitně uvedeno v mo.email.contestant_list_url @app.route('/org/contest/c/<int:id>/ucastnici', methods=('GET', 'POST')) @app.route('/org/contest/c/<int:id>/site/<int:site_id>/ucastnici', methods=('GET', 'POST')) @app.route('/org/contest/c/<int:id>/ucastnici/emails', endpoint="org_contest_list_emails") -- GitLab