[#1335] Reorganized users.mutes as relation to UserMute entity.

This commit is contained in:
Ivan Tashkinov 2019-11-15 21:38:54 +03:00
commit c31ddce51e
16 changed files with 258 additions and 64 deletions

View file

@ -868,7 +868,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
user = insert(:user)
other_user = insert(:user)
{:ok, user} = User.mute(user, other_user)
{:ok, _user_mute} = User.mute(user, other_user)
conn =
conn

View file

@ -289,7 +289,10 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
assert length(json_response(conn, 200)) == 1
{:ok, user} = User.mute(user, user2)
{:ok, _user_mute} = User.mute(user, user2)
# Refreshing to reflect embedded ap id relation fields (remove once removed)
user = refresh_record(user)
conn = assign(build_conn(), :user, user)
conn = get(conn, "/api/v1/notifications")
@ -310,7 +313,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
assert length(json_response(conn, 200)) == 1
{:ok, user} = User.mute(user, user2, false)
{:ok, _user_mute} = User.mute(user, user2, false)
conn = assign(build_conn(), :user, user)
conn = get(conn, "/api/v1/notifications")
@ -333,7 +336,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
assert length(json_response(conn, 200)) == 1
{:ok, user} = User.mute(user, user2)
{:ok, _user_mute} = User.mute(user, user2)
conn = assign(build_conn(), :user, user)
conn = get(conn, "/api/v1/notifications", %{"with_muted" => "true"})

View file

@ -191,9 +191,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
{:ok, user} = User.follow(user, other_user)
{:ok, other_user} = User.follow(other_user, user)
{:ok, other_user} = User.subscribe(user, other_user)
{:ok, user} = User.mute(user, other_user, true)
{:ok, _user_mute} = User.mute(user, other_user, true)
{:ok, user} = CommonAPI.hide_reblogs(user, other_user)
# Refreshing to reflect embedded ap id relation fields (remove once removed)
user = refresh_record(user)
expected = %{
id: to_string(other_user.id),
following: true,

View file

@ -183,7 +183,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
user = insert(:user)
other_user = insert(:user)
{:ok, user} = User.mute(user, other_user)
{:ok, _user_mute} = User.mute(user, other_user)
{:ok, activity} = CommonAPI.post(other_user, %{"status" => "test"})
status = StatusView.render("show.json", %{activity: activity})
@ -199,7 +199,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
user = insert(:user)
other_user = insert(:user)
{:ok, user} = User.mute(user, other_user)
{:ok, _user_mute} = User.mute(user, other_user)
{:ok, activity} = CommonAPI.post(other_user, %{"status" => "test"})
status = StatusView.render("show.json", %{activity: activity, for: user})