def thread_muted?(%{id: nil} = _user, _activity), do: false
def thread_muted?(user, activity) do
- ThreadMute.check_muted(user.id, activity.data["context"]) != []
+ ThreadMute.exists?(user.id, activity.data["context"])
end
def report(user, %{"account_id" => account_id} = data) do
}
}
- relationships_opt = %{relationships: opts[:relationships]}
+ render_opts = %{relationships: opts[:relationships]}
case mastodon_type do
"mention" ->
- put_status(response, activity, reading_user, relationships_opt)
+ put_status(response, activity, reading_user, render_opts)
"favourite" ->
- put_status(response, parent_activity_fn.(), reading_user, relationships_opt)
+ put_status(response, parent_activity_fn.(), reading_user, render_opts)
"reblog" ->
- put_status(response, parent_activity_fn.(), reading_user, relationships_opt)
+ put_status(response, parent_activity_fn.(), reading_user, render_opts)
"move" ->
- put_target(response, activity, reading_user, relationships_opt)
+ put_target(response, activity, reading_user, render_opts)
"follow" ->
response
"pleroma:emoji_reaction" ->
response
- |> put_status(parent_activity_fn.(), reading_user, relationships_opt)
+ |> put_status(parent_activity_fn.(), reading_user, render_opts)
|> put_emoji(activity)
_ ->
end
thread_muted? =
- case activity.thread_muted? do
- thread_muted? when is_boolean(thread_muted?) -> thread_muted?
- nil -> (opts[:for] && CommonAPI.thread_muted?(opts[:for], activity)) || false
+ cond do
+ is_nil(opts[:for]) -> false
+ is_boolean(activity.thread_muted?) -> activity.thread_muted?
+ true -> CommonAPI.thread_muted?(opts[:for], activity)
end
attachment_data = object.data["attachment"] || []
describe "relationship" do
defp test_relationship_rendering(user, other_user, expected_result) do
- opts = %{user: user, target: other_user}
+ opts = %{user: user, target: other_user, relationships: nil}
assert expected_result == AccountView.render("relationship.json", opts)
relationships_opt = UserRelationship.view_relationships_option(user, [other_user])