funkwhale/api/funkwhale_api/history/activities.py

17 wiersze
492 B
Python

from funkwhale_api.common import channels
from funkwhale_api.activity import record
from . import serializers
record.registry.register_serializer(serializers.ListeningActivitySerializer)
@record.registry.register_consumer("history.Listening")
def broadcast_listening_to_instance_activity(data, obj):
if obj.user.privacy_level not in ["instance", "everyone"]:
return
channels.group_send(
"instance_activity", {"type": "event.send", "text": "", "data": data}
)