From f6e9bcea9714f4b25d7dacda415eebf28d9bb871 Mon Sep 17 00:00:00 2001
From: Martin Mares <mj@ucw.cz>
Date: Mon, 29 Nov 2021 15:23:46 +0100
Subject: [PATCH] =?UTF-8?q?P=C5=99ihl=C3=A1=C5=A1ka:=20Org=20s=20vypnut?=
 =?UTF-8?q?=C3=BDm=20email=5Fnotify=20nezp=C5=AFsobuje=20eskalaci=20vy?=
 =?UTF-8?q?=C5=A1=C5=A1=C3=ADm=20garant=C5=AFm?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Pokud na nějaké úrovni hierarchie existují garanti, ale všichni mají
vypnuté email_notify, nechceme přejít na vyšší úroveň.
---
 mo/web/user.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mo/web/user.py b/mo/web/user.py
index 65cd3c86..851b3cc7 100644
--- a/mo/web/user.py
+++ b/mo/web/user.py
@@ -237,11 +237,12 @@ 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) and ur.user.email_notify}
+        notify = {ur.user for ur in uroles if ur.applies_to(at=place, year=r.year, cat=r.category, seq=r.seq)}
         if notify:
             for org in notify:
-                logger.info(f'Join: Notifikuji orga <{org.email}> pro místo {place.get_code()}')
-                mo.email.send_join_notify_email(org, g.user, c)
+                logger.info(f'Join: {"Notifikuji" if org.email_notify else "Nenotifikuji"} orga <{org.email}> pro místo {place.get_code()}')
+                if org.email_notify:
+                    mo.email.send_join_notify_email(org, g.user, c)
             return
         place = place.parent_place
 
-- 
GitLab