# HG changeset patch # User Marcin Kuzminski # Date 2018-12-06 16:54:43 # Node ID 97a795744290f55bcd7c1e58f97f666a9e8306b9 # Parent a7a2e1397eec47691e1e9823400ea849f8497bc3 notifications: use a set initially instead of list later converted to set. diff --git a/rhodecode/model/notification.py b/rhodecode/model/notification.py --- a/rhodecode/model/notification.py +++ b/rhodecode/model/notification.py @@ -95,15 +95,14 @@ class NotificationModel(BaseModel): log.debug('sending notifications %s to admins: %s', notification_type, recipients_objs) else: - recipients_objs = [] + recipients_objs = set() for u in recipients: obj = self._get_user(u) if obj: - recipients_objs.append(obj) + recipients_objs.add(obj) else: # we didn't find this user, log the error and carry on log.error('cannot notify unknown user %r', u) - recipients_objs = set(recipients_objs) if not recipients_objs: raise Exception('no valid recipients specified') @@ -122,7 +121,7 @@ class NotificationModel(BaseModel): return notification # don't send email to person who created this comment - rec_objs = set(recipients_objs).difference(set([created_by_obj])) + rec_objs = set(recipients_objs).difference({created_by_obj}) # now notify all recipients in question