Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core
Commits: 6081448c by Abhilash Raj at 2019-05-08T16:31:19Z Allow setting a comment when handling held messages. - - - - - c5f97198 by Abhilash Raj at 2019-05-08T18:01:50Z Merge branch 'held-reason' into 'master' Allow setting a comment when handling held messages. See merge request mailman/mailman!512 - - - - - 3 changed files: - src/mailman/docs/NEWS.rst - src/mailman/rest/post_moderation.py - src/mailman/rest/tests/test_moderation.py Changes: ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -42,6 +42,7 @@ REST * Expose a user's preferred address using REST API. (Closes #240) * Expose `header_matches/find` API to find a list of ``HeaderMatches`` belonging to a MailingList. (See !497) +* Allow adding a comment when rejecting held messages. (Closes #594) Other ----- ===================================== src/mailman/rest/post_moderation.py ===================================== @@ -119,7 +119,10 @@ class HeldMessage(_HeldMessageBase): def on_post(self, request, response): try: - validator = Validator(action=enum_validator(Action)) + validator = Validator( + action=enum_validator(Action), + comment=str, + _optional=('comment',)) arguments = validator(request) except ValueError as error: bad_request(response, str(error)) ===================================== src/mailman/rest/tests/test_moderation.py ===================================== @@ -162,6 +162,23 @@ Something else. self.assertEqual(json['total_size'], 1) self.assertEqual(json['entries'][0]['request_id'], held_id) + def test_handle_message_with_comment(self): + self._msg = mfs("""\ +From: a...@example.com +To: a...@example.com +Subject: Hello +Message-ID: <alpha> + +Something else. +""") + with transaction(): + held_id = hold_message(self._mlist, self._msg) + json, response = call_api( + 'http://localhost:9001/3.0/lists/a...@example.com' + '/held/{}'.format(held_id), + dict(action='reject', comment='Because I want to.')) + self.assertEqual(response.status_code, 204) + class TestSubscriptionModeration(unittest.TestCase): layer = RESTLayer View it on GitLab: https://gitlab.com/mailman/mailman/compare/4cdd8990f3efebc93156313b8de9eebebcbf0adb...c5f97198f9d509a788025aa6df249841469bbe13 -- View it on GitLab: https://gitlab.com/mailman/mailman/compare/4cdd8990f3efebc93156313b8de9eebebcbf0adb...c5f97198f9d509a788025aa6df249841469bbe13 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org