Merge branch 'mute-expiration' into 'develop'

MastoAPI: Show mutes expiration date

See merge request pleroma/pleroma!3682
This commit is contained in:
tusooa 2022-07-23 00:34:15 +00:00
commit 301ce5bc62
7 changed files with 90 additions and 13 deletions

View file

@ -634,4 +634,21 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|> assert()
end
end
test "renders mute expiration date" do
user = insert(:user)
other_user = insert(:user)
{:ok, _user_relationships} =
User.mute(user, other_user, %{notifications: true, expires_in: 24 * 60 * 60})
%{
mute_expires_at: mute_expires_at
} = AccountView.render("show.json", %{user: other_user, for: user, mutes: true})
assert DateTime.diff(
mute_expires_at,
DateTime.utc_now() |> DateTime.add(24 * 60 * 60)
) in -3..3
end
end