tests for mastodon_api_controller.ex

This commit is contained in:
Maksim Pechnikov 2019-09-06 21:50:00 +03:00
commit ab2f21e470
7 changed files with 438 additions and 165 deletions

View file

@ -228,4 +228,11 @@ defmodule Pleroma.Object do
_ -> :noop
end
end
@doc "Updates data field of an object"
def update_data(%Object{data: data} = object, attrs \\ %{}) do
object
|> Object.change(%{data: Map.merge(data || %{}, attrs)})
|> Repo.update()
end
end