From 34b5eb783085cc77e57c962b7dc985556b7b7698 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20Pe=C3=B1a?= <devilcius@gmail.com>
Date: Sat, 25 Sep 2021 11:19:57 +0000
Subject: [PATCH] Resolve "Subsonic API scrobble call not triggering scrobble
 plugin"

---
 api/funkwhale_api/subsonic/views.py | 6 ++++++
 changes/changelog.d/1416.bugfix     | 1 +
 2 files changed, 7 insertions(+)
 create mode 100644 changes/changelog.d/1416.bugfix

diff --git a/api/funkwhale_api/subsonic/views.py b/api/funkwhale_api/subsonic/views.py
index 4f743abc32..3fe647140a 100644
--- a/api/funkwhale_api/subsonic/views.py
+++ b/api/funkwhale_api/subsonic/views.py
@@ -14,6 +14,7 @@ from rest_framework import permissions as rest_permissions
 from rest_framework import renderers, response, viewsets
 from rest_framework.decorators import action
 from rest_framework.serializers import ValidationError
+from config import plugins
 
 import funkwhale_api
 from funkwhale_api.activity import record
@@ -810,6 +811,11 @@ class SubsonicViewSet(viewsets.GenericViewSet):
             )
         if serializer.validated_data["submission"]:
             listening = serializer.save()
+            plugins.trigger_hook(
+                plugins.LISTENING_CREATED,
+                listening=listening,
+                confs=plugins.get_confs(request.user),
+            )
             record.send(listening)
         return response.Response({})
 
diff --git a/changes/changelog.d/1416.bugfix b/changes/changelog.d/1416.bugfix
new file mode 100644
index 0000000000..25efa5a9be
--- /dev/null
+++ b/changes/changelog.d/1416.bugfix
@@ -0,0 +1 @@
+Fixes subsonic scrobble not triggering plugin hook (#1416)
-- 
GitLab