Implement mastodon's reblog hiding feature
This commit is contained in:
parent
41fc67aa49
commit
c8f31e0bc2
6 changed files with 56 additions and 2 deletions
|
|
@ -723,11 +723,24 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
|
||||
def follow(%{assigns: %{user: follower}} = conn, %{"id" => id}) do
|
||||
with %User{} = followed <- Repo.get(User, id),
|
||||
false <- User.following?(follower, followed),
|
||||
{:ok, follower, followed, _} <- CommonAPI.follow(follower, followed) do
|
||||
conn
|
||||
|> put_view(AccountView)
|
||||
|> render("relationship.json", %{user: follower, target: followed})
|
||||
else
|
||||
true ->
|
||||
case conn.params["reblogs"] do
|
||||
true -> CommonAPI.show_reblogs(follower, id)
|
||||
false -> CommonAPI.hide_reblogs(follower, id)
|
||||
end
|
||||
|
||||
followed = Repo.get(User, id)
|
||||
|
||||
conn
|
||||
|> put_view(AccountView)
|
||||
|> render("relationship.json", %{user: follower, target: followed})
|
||||
|
||||
{:error, message} ->
|
||||
conn
|
||||
|> put_resp_content_type("application/json")
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
muting_notifications: false,
|
||||
requested: requested,
|
||||
domain_blocking: false,
|
||||
showing_reblogs: false,
|
||||
showing_reblogs: User.showing_reblogs?(user, target),
|
||||
endorsed: false
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue