We're using Mailman 3.3.9.

My team and I have written a simple UI for displaying and approving/rejecting 
held messages from non list members. When an email receives an "always accept" 
flag from the UI we call the API to pass in the requested information:
```
Form form = new Form();
form.param("action", "accept");
Entity<Form> data = Entity.entity(form, 
MediaType.APPLICATION_FORM_URLENCODED_TYPE);
String safePath = 
UriBuilder.fromPath("lists/{listId}/held/{messageId}").build(listId, 
messageId).toString();
response = getTarget().path(safePath).request().post(data);
```
If that request is successful we update the `accept_these_nonmembers` property 
of the mailing list with the user's email.
```
Form form = new Form();
if (fieldValue.getClass().isArray()) {
    for (String val : (String[])fieldValue) {
        form.param(property, String.valueOf(val));
    }
} else {
    form.param(property, String.valueOf(fieldValue));
}
Entity<Form> data = Entity.entity(form, 
MediaType.APPLICATION_FORM_URLENCODED_TYPE);
response = getTarget().path("lists/" + listId + 
"/config").request().method("PATCH", data);
```

The result of these two API calls is that both the subscribers and nonmembers 
properties of the mailing list are updated to include the new email (let's call 
it a...@123.com). The user can immediately send another email which is not held 
for moderation. The issue comes when a different nonmember sends an email and 
is approved (let's call it x...@789.com). For some reason this blows out the 
"always accept" status of user a...@123.com and requires their email to be 
approved again.

After some research I believe this is because the `accept_these_nonmembers` 
property has been deprecated (which seems valid because that property remains 
an empty array). Additional reading seems to indicate that we can now set 
`moderation_action` on each individual user which supercedes the mailing list's 
`default_nonmember_action` property (in our case it is `Action.hold`).

The docs indicate that I should be able to submit a patch request to update the 
moderation action for any user:
https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/membership.html#moderating-a-member

But it requires the user ID. And when trying to get the user_id for a nonmember 
it appears that it is not returned by the API. The following call:
`/3.0/addresses/a...@123.com`

returns 
```
{
    "email": "a...@123.com",
    "original_email": "a...@123.com",
    "registered_on": "2025-03-03T19:18:35.169703",
    "self_link": "https://0.0.0.0:8001/3.0/addresses/a...@123.com";,
    "http_etag": "\"92c44d0b3b323450f3576e6352acb59b4cc5d6f0a\""
}
```
So I'm not sure how I would be able to update this particular record without a 
member or user id.

So, all that said, I'm looking for information on how to do one of the 
following.

1. When submitting a user's email to the `accept_these_nonmembers`, is there a 
way to indicate that the `member.moderation_action` should be a specific value?
2. Retrieve a nonmember record and have it include a member or user id that I 
can use to explicitly update the `member.moderation_action` value?

There may of course be additional approaches that I'm not considering, but 
that's about the gist of it. Thoughts?
_______________________________________________
Mailman-users mailing list -- mailman-users@mailman3.org
To unsubscribe send an email to mailman-users-le...@mailman3.org
https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Archived at: 
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/DRPVEOHE75XFZ5QW6XAKOCMDJHXCXBZZ/

This message sent to arch...@mail-archive.com

Reply via email to