Treat User.Info pinned ids as strings

This commit is contained in:
href 2019-01-16 16:15:46 +01:00
parent e36a434b99
commit 973c9eed18
No known key found for this signature in database
GPG Key ID: EE8296C1A152C325
2 changed files with 3 additions and 5 deletions

View File

@ -31,7 +31,7 @@ defmodule Pleroma.User.Info do
field(:hub, :string, default: nil)
field(:salmon, :string, default: nil)
field(:hide_network, :boolean, default: false)
field(:pinned_activities, {:array, :integer}, default: [])
field(:pinned_activities, {:array, :string}, default: [])
# Found in the wild
# ap_id -> Where is this used?

View File

@ -378,8 +378,7 @@ def unretweet(%{assigns: %{user: user}} = conn, %{"id" => id}) do
end
def pin(%{assigns: %{user: user}} = conn, %{"id" => id}) do
with {_, {:ok, id}} <- {:param_cast, Ecto.Type.cast(:integer, id)},
{:ok, activity} <- TwitterAPI.pin(user, id) do
with {:ok, activity} <- TwitterAPI.pin(user, id) do
conn
|> put_view(ActivityView)
|> render("activity.json", %{activity: activity, for: user})
@ -390,8 +389,7 @@ def pin(%{assigns: %{user: user}} = conn, %{"id" => id}) do
end
def unpin(%{assigns: %{user: user}} = conn, %{"id" => id}) do
with {_, {:ok, id}} <- {:param_cast, Ecto.Type.cast(:integer, id)},
{:ok, activity} <- TwitterAPI.unpin(user, id) do
with {:ok, activity} <- TwitterAPI.unpin(user, id) do
conn
|> put_view(ActivityView)
|> render("activity.json", %{activity: activity, for: user})