[tasks] Fix updating and stopping tasks from Emacs
This commit is contained in:
@ -524,37 +524,6 @@ def gps_webhook(request):
|
||||
return Response({"scrobble_id": scrobble.id}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
@permission_classes([IsAuthenticated])
|
||||
@api_view(["POST"])
|
||||
def emacs_webhook(request):
|
||||
try:
|
||||
data_dict = json.loads(request.data)
|
||||
except TypeError:
|
||||
data_dict = request.data
|
||||
|
||||
logger.info(
|
||||
"[emacs_webhook] called",
|
||||
extra={
|
||||
"post_data": data_dict,
|
||||
"user_id": 1,
|
||||
},
|
||||
)
|
||||
data_dict["source"] = "orgmode"
|
||||
data_dict["source_id"] = data_dict.pop("emacs_id")
|
||||
|
||||
user_id = request.user.id
|
||||
if not user_id:
|
||||
user_id = 1
|
||||
|
||||
scrobble = emacs_scrobble_task(data_dict, user_id)
|
||||
|
||||
if not scrobble:
|
||||
return Response({"data": data_dict}, status=status.HTTP_200_OK)
|
||||
|
||||
return Response({"scrobble_id": scrobble.id}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
@permission_classes([IsAuthenticated])
|
||||
@api_view(["POST"])
|
||||
|
||||
Reference in New Issue
Block a user