From 26c0d2565b3253849489199df2aac53a94a40848 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 7 Apr 2024 15:48:30 -0400 Subject: [PATCH] Include device token in registration response --- .../controllers/app_registrations_controller.ex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/tusker_push_web/controllers/app_registrations_controller.ex b/lib/tusker_push_web/controllers/app_registrations_controller.ex index 23b6732..ab4fc1b 100644 --- a/lib/tusker_push_web/controllers/app_registrations_controller.ex +++ b/lib/tusker_push_web/controllers/app_registrations_controller.ex @@ -21,7 +21,8 @@ defmodule TuskerPushWeb.AppRegistrationsController do conn |> json(%{ id: id, - endpoint: url(~p"/mastodon/v1/push/#{id}") + endpoint: url(~p"/mastodon/v1/push/#{id}"), + device_token: token }) else {:error, %Changeset{valid?: false} = changeset} -> @@ -64,7 +65,11 @@ defmodule TuskerPushWeb.AppRegistrationsController do {:registration, TuskerPush.get_registration(id)}, {:ok, _} <- TuskerPush.update_registration(registration, params) do conn - |> json(%{id: id, endpoint: url(~p"/mastodon/v1/push/#{id}")}) + |> json(%{ + id: id, + endpoint: url(~p"/mastodon/v1/push/#{id}"), + device_token: token + }) else {:registration, nil} -> conn