Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
7c51d8ad by Mark Sapiro at 2021-03-28T20:28:07-07:00
Remove handled messages from the message store.

- - - - -
dd04db70 by Mark Sapiro at 2021-03-29T15:57:57+00:00
Merge branch 'rmmsg' into 'master'

Remove handled messages from the message store.

Closes #257

See merge request mailman/mailman!814
- - - - -


3 changed files:

- src/mailman/app/moderator.py
- src/mailman/app/tests/test_moderation.py
- src/mailman/docs/NEWS.rst


Changes:

=====================================
src/mailman/app/moderator.py
=====================================
@@ -168,9 +168,10 @@ def handle_message(mlist, id, action, comment=None, 
forward=None):
         fmsg.set_type('message/rfc822')
         fmsg.attach(msg)
         fmsg.send(mlist)
-    # Delete the request if it's not being kept.
+    # Delete the request and message if it's not being kept.
     if not keep:
         requestdb.delete_request(id)
+        message_store.delete_message(message_id)
     # Log the rejection
     if rejection:
         note = """%s: %s posting:


=====================================
src/mailman/app/tests/test_moderation.py
=====================================
@@ -25,6 +25,7 @@ from mailman.app.moderator import (
 from mailman.interfaces.action import Action
 from mailman.interfaces.member import MemberRole
 from mailman.interfaces.messages import IMessageStore
+from mailman.interfaces.pending import IPendings
 from mailman.interfaces.requests import IListRequests
 from mailman.interfaces.subscriptions import ISubscriptionManager
 from mailman.interfaces.usermanager import IUserManager
@@ -137,14 +138,17 @@ Message-ID: <alpha>
         handle_message(self._mlist, request_id, Action.discard)
         self.assertEqual(self._request_db.count, 0)
 
-    def test_handled_message_stays_in_store(self):
-        # The message is still available in the store, even when it's been
-        # disposed of.
+    def test_handled_message_removed_from_store(self):
+        # The message is removed from the store and the pendings db when it's
+        # been disposed of.
         request_id = hold_message(self._mlist, self._msg)
+        # Get the hash for this pending request.
+        hash = list(self._request_db.held_requests)[0].data_hash
         handle_message(self._mlist, request_id, Action.discard)
         self.assertEqual(self._request_db.count, 0)
         message = getUtility(IMessageStore).get_message_by_id('<alpha>')
-        self.assertEqual(message['subject'], 'hold me')
+        self.assertIsNone(message)
+        self.assertIsNone(getUtility(IPendings).confirm(hash))
 
 
 class TestUnsubscription(unittest.TestCase):


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -20,6 +20,8 @@ Bugs
 * Bounce runner now properly commits database transactions.  (Closes #850)
 * Pending subscriptions now have a lifetime equal to the configured
   ``pending_request_life`` rather than 3650 days.  (Closes #729)
+* Held messages which are handled are now removed from the message store and
+  the pending db.  (Closes #257)
 
 .. _news-3.3.4:
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/c821a8b33e7fd49b13836247966394aed2f6697a...dd04db700ce79f35a350623fd4688b784818e8e3

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/c821a8b33e7fd49b13836247966394aed2f6697a...dd04db700ce79f35a350623fd4688b784818e8e3
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to