From 2b2bd0e047c96085dda003f0ae11ddc05bbc8c12 Mon Sep 17 00:00:00 2001 From: shadowfacts Date: Mon, 3 Sep 2018 01:40:05 +0000 Subject: [PATCH 1/3] Render notification IDs as strings, not numbers --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index e0267f1dc..b3c234010 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1033,7 +1033,7 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created case activity.data["type"] do "Create" -> %{ - id: id, + id: id |> to_string, type: "mention", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), @@ -1044,7 +1044,7 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created liked_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"]) %{ - id: id, + id: id |> to_string, type: "favourite", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), @@ -1055,7 +1055,7 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created announced_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"]) %{ - id: id, + id: id |> to_string, type: "reblog", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), @@ -1064,7 +1064,7 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created "Follow" -> %{ - id: id, + id: id |> to_string, type: "follow", created_at: created_at, account: AccountView.render("account.json", %{user: actor}) From 26f8697400cf9c9fd4d33748bf3aadedbb55d981 Mon Sep 17 00:00:00 2001 From: shadowfacts Date: Mon, 3 Sep 2018 01:52:02 +0000 Subject: [PATCH 2/3] Update mastodon_api_controller.ex --- .../web/mastodon_api/mastodon_api_controller.ex | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index b3c234010..576e9d3ce 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1029,11 +1029,13 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created created_at = NaiveDateTime.to_iso8601(created_at) |> String.replace(~r/(\.\d+)?$/, ".000Z", global: false) + + id = id |> to_string case activity.data["type"] do "Create" -> %{ - id: id |> to_string, + id: id, type: "mention", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), @@ -1044,7 +1046,7 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created liked_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"]) %{ - id: id |> to_string, + id: id, type: "favourite", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), @@ -1055,7 +1057,7 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created announced_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"]) %{ - id: id |> to_string, + id: id, type: "reblog", created_at: created_at, account: AccountView.render("account.json", %{user: actor}), @@ -1064,7 +1066,7 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created "Follow" -> %{ - id: id |> to_string, + id: id, type: "follow", created_at: created_at, account: AccountView.render("account.json", %{user: actor}) From 35515cfa66f39d618be5702137d296b7bc25b65e Mon Sep 17 00:00:00 2001 From: shadowfacts Date: Mon, 3 Sep 2018 01:58:55 +0000 Subject: [PATCH 3/3] Update mastodon_api_controller.ex --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 576e9d3ce..8279db93e 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1029,7 +1029,7 @@ def render_notification(user, %{id: id, activity: activity, inserted_at: created created_at = NaiveDateTime.to_iso8601(created_at) |> String.replace(~r/(\.\d+)?$/, ".000Z", global: false) - + id = id |> to_string case activity.data["type"] do