Projet

Général

Profil

0001-workflows-fix-notifications-to-non-submitter-when-i1.patch

Frédéric Péters, 02 décembre 2022 15:39

Télécharger (1,99 ko)

Voir les différences:

Subject: [PATCH] workflows: fix notifications to non-submitter when i18n is
 enabled (#71973)

 tests/workflow/test_notification.py | 11 ++++++++++-
 wcs/wf/notification.py              |  3 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)
tests/workflow/test_notification.py
143 143
    assert set(json.loads(http_requests.get_last('body'))['name_ids']) == {'xxy1'}
144 144

  
145 145

  
146
def test_notifications_to_users_template(pub, http_requests):
146
@pytest.mark.parametrize('i18n', [True, False])
147
def test_notifications_to_users_template(pub, http_requests, i18n):
148
    if i18n:
149
        pub.cfg['language'] = {
150
            'language': 'en',
151
            'multilinguism': True,
152
            'languages': ['en', 'fr'],
153
            'default_site_language': 'http',
154
        }
155

  
147 156
    pub.user_class.wipe()
148 157
    FormDef.wipe()
149 158

  
wcs/wf/notification.py
169 169
                        to = self.to
170 170
                        self.to = ['_submitter']
171 171
                        self.perform(formdata, ignore_i18n=True)
172
                        self.to = to
172 173
                # and others in the site language
173
                self.to = [x for x in to if x != '_submitter']
174
                self.to = [x for x in self.to if x != '_submitter']
174 175
                with get_publisher().with_language(get_publisher().get_default_language()):
175 176
                    self.perform(formdata, ignore_i18n=True)
176 177
            finally:
177
-