Set moderation_action
to defer for moderators
this is apparently not automatic with Mailman 3
This commit is contained in:
parent
3a224fcff2
commit
8c56388284
@ -123,6 +123,23 @@ def sync_moderators(
|
|||||||
list.remove_moderator(member.address.email)
|
list.remove_moderator(member.address.email)
|
||||||
|
|
||||||
|
|
||||||
|
def fixup_moderation_actions(list: mailmanclient.MailingList, dry_run: bool):
|
||||||
|
expected_moderators = list.moderators
|
||||||
|
for member in list.members:
|
||||||
|
if member.address in expected_moderators:
|
||||||
|
moderation_action = "defer"
|
||||||
|
else:
|
||||||
|
moderation_action = ""
|
||||||
|
|
||||||
|
if member.moderation_action != moderation_action:
|
||||||
|
print(
|
||||||
|
f"Updating Moderation action for {member} ({member.moderation_action} -> {moderation_action}) in list {list}"
|
||||||
|
)
|
||||||
|
if not dry_run:
|
||||||
|
member.moderation_action = moderation_action
|
||||||
|
member.save()
|
||||||
|
|
||||||
|
|
||||||
def update_cloudflare_lists(
|
def update_cloudflare_lists(
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
auth_token: str,
|
auth_token: str,
|
||||||
@ -198,11 +215,12 @@ def main(
|
|||||||
print(f"Configuring/syncing {name}...")
|
print(f"Configuring/syncing {name}...")
|
||||||
config_list(list, dry_run, **props["config"])
|
config_list(list, dry_run, **props["config"])
|
||||||
|
|
||||||
if "moderators" in props:
|
|
||||||
sync_moderators(list, dry_run, set(props["moderators"]))
|
|
||||||
sync_members(
|
sync_members(
|
||||||
list, dry_run, set(props["members"]) | set(props.get("moderators", []))
|
list, dry_run, set(props["members"]) | set(props.get("moderators", []))
|
||||||
)
|
)
|
||||||
|
if "moderators" in props:
|
||||||
|
sync_moderators(list, dry_run, set(props["moderators"]))
|
||||||
|
fixup_moderation_actions(list, dry_run)
|
||||||
|
|
||||||
lists = [list.list_name.lower() for list in domain.get_lists()]
|
lists = [list.list_name.lower() for list in domain.get_lists()]
|
||||||
update_cloudflare_lists(
|
update_cloudflare_lists(
|
||||||
|
Loading…
Reference in New Issue
Block a user