From 8e1dbf35043f55edb3667fb1d942fb9d9004daba Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Wed, 29 Sep 2021 22:38:10 +0200
Subject: [PATCH] =?UTF-8?q?Registrace:=20Notifikovat=20pouze=20u=C5=BEivat?=
 =?UTF-8?q?ele,=20kte=C5=99=C3=AD=20si=20to=20p=C5=99ej=C3=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Také při té příležitosti eliminujeme duplicitní notifikace, pokud má
někdo více roli k jednomu místu.
---
 mo/web/user.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mo/web/user.py b/mo/web/user.py
index ee53d404..a62e57fd 100644
--- a/mo/web/user.py
+++ b/mo/web/user.py
@@ -237,7 +237,7 @@ def join_notify(c: db.Contest) -> None:
                   .filter_by(place_id=place.place_id)
                   .options(joinedload(db.UserRole.user))
                   .all())
-        notify = [ur.user for ur in uroles if ur.applies_to(at=place, year=r.year, cat=r.category, seq=r.seq)]
+        notify = {ur.user for ur in uroles if ur.applies_to(at=place, year=r.year, cat=r.category, seq=r.seq) and ur.user.email_notify}
         if notify:
             for org in notify:
                 logger.info(f'Join: Notifikuji orga <{org.email}> pro místo {place.get_code()}')
-- 
GitLab