~fabrixxm/activist

858b2c687d78ebe806fbf6897281b7b731a324b9 — fabrixxm 10 months ago 1cbb979
Fix "publish" task recipients expansion
1 files changed, 5 insertions(+), 3 deletions(-)

M activist/tasks.py
M activist/tasks.py => activist/tasks.py +5 -3
@@ 4,7 4,7 @@ Background tasks

import json
import logging
from .background import background, execute
from .background import background
from . import store
from .activitystream import AS_PUBLIC
from . import activitypub


@@ 24,11 24,13 @@ def publish(obj_id:str):
    for prop in [ "to", "bto", "cc", "bcc", "audience" ]:
        if prop in obj:
            recipient = obj[prop]
            if recipient == AS_PUBLIC:
                recipient = store.list_get("followers")
            if isinstance(recipient, str):
                recipient = [recipient]
            if AS_PUBLIC in recipient:
                recipient.remove(AS_PUBLIC)
                recipient += store.list_get("followers")
            recipients += recipient
    logger.info("publish to %r", recipients)
    for actor_id in recipients:
        actor = store.load(actor_id)
        inbox = actor.get('inbox', None)