funkwhale/api/funkwhale_api/history/activities.py

17 wiersze
492 B
Python
Czysty Zwykły widok Historia

2018-03-01 22:41:51 +00:00
from funkwhale_api.common import channels
from funkwhale_api.activity import record
from . import serializers
2018-06-09 13:36:16 +00:00
record.registry.register_serializer(serializers.ListeningActivitySerializer)
2018-03-01 22:41:51 +00:00
2018-06-09 13:36:16 +00:00
@record.registry.register_consumer("history.Listening")
2018-03-01 22:41:51 +00:00
def broadcast_listening_to_instance_activity(data, obj):
2018-06-09 13:36:16 +00:00
if obj.user.privacy_level not in ["instance", "everyone"]:
2018-03-01 22:41:51 +00:00
return
2018-06-09 13:36:16 +00:00
channels.group_send(
"instance_activity", {"type": "event.send", "text": "", "data": data}
)