Projet

Général

Profil

0004-wf-do-not-notify-inactive-users-42428.patch

Benjamin Dauvergne, 07 juillet 2020 16:36

Télécharger (1,63 ko)

Voir les différences:

Subject: [PATCH 4/5] wf: do not notify inactive users (#42428)

 tests/test_workflows.py | 8 ++++++++
 wcs/wf/notification.py  | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
tests/test_workflows.py
4558 4558
        'https://portal/api/notification/add/?NameID=xxy1',
4559 4559
        'https://portal/api/notification/add/?NameID=xxy2'])
4560 4560

  
4561
    # test inactive users are ignored
4562
    user2.is_active = False
4563
    user2.store()
4564
    http_requests.empty()
4565
    item.perform(formdata)
4566
    assert http_requests.count() == 1
4567
    assert set(x['url'] for x in http_requests.requests) == set(['https://portal/api/notification/add/?NameID=xxy1'])
4568

  
4561 4569

  
4562 4570
def test_workflow_field_migration(pub):
4563 4571
    Workflow.wipe()
wcs/wf/notification.py
137 137
                role = Role.get(dest)
138 138
            except KeyError:
139 139
                continue
140
            users.extend(get_publisher().user_class.get_users_with_role(role.id))
140
            users.extend(user for user in get_publisher().user_class.get_users_with_role(role.id) if user.is_active)
141 141

  
142 142
        for user in users:
143 143
            if not user:
144
-