[#1335] Implemented notification mutes and reblog mutes as UserRelationships. User to UserRelationship relations and functions refactoring.
This commit is contained in:
parent
3aaf3aa2c2
commit
ba5cc30165
21 changed files with 203 additions and 229 deletions
|
|
@ -868,7 +868,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, _user_mute} = User.mute(user, other_user)
|
||||
{:ok, _user_relationships} = User.mute(user, other_user)
|
||||
|
||||
conn =
|
||||
conn
|
||||
|
|
@ -883,7 +883,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, _user_block} = User.block(user, other_user)
|
||||
{:ok, _user_relationship} = User.block(user, other_user)
|
||||
|
||||
conn =
|
||||
conn
|
||||
|
|
|
|||
|
|
@ -289,10 +289,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
|
|||
|
||||
assert length(json_response(conn, 200)) == 1
|
||||
|
||||
{:ok, _user_mute} = User.mute(user, user2)
|
||||
|
||||
# Refreshing to reflect embedded ap id relation fields (remove once removed)
|
||||
user = refresh_record(user)
|
||||
{:ok, _user_relationships} = User.mute(user, user2)
|
||||
|
||||
conn = assign(build_conn(), :user, user)
|
||||
conn = get(conn, "/api/v1/notifications")
|
||||
|
|
@ -313,7 +310,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
|
|||
|
||||
assert length(json_response(conn, 200)) == 1
|
||||
|
||||
{:ok, _user_mute} = User.mute(user, user2, false)
|
||||
{:ok, _user_relationships} = User.mute(user, user2, false)
|
||||
|
||||
conn = assign(build_conn(), :user, user)
|
||||
conn = get(conn, "/api/v1/notifications")
|
||||
|
|
@ -336,7 +333,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
|
|||
|
||||
assert length(json_response(conn, 200)) == 1
|
||||
|
||||
{:ok, _user_mute} = User.mute(user, user2)
|
||||
{:ok, _user_relationships} = User.mute(user, user2)
|
||||
|
||||
conn = assign(build_conn(), :user, user)
|
||||
conn = get(conn, "/api/v1/notifications", %{"with_muted" => "true"})
|
||||
|
|
|
|||
|
|
@ -1108,7 +1108,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
activity: activity
|
||||
} do
|
||||
other_user = insert(:user)
|
||||
{:ok, _user_block} = User.block(user, other_user)
|
||||
{:ok, _user_relationship} = User.block(user, other_user)
|
||||
|
||||
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
|
||||
|
||||
|
|
@ -1205,7 +1205,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
activity: activity
|
||||
} do
|
||||
other_user = insert(:user)
|
||||
{:ok, _user_block} = User.block(user, other_user)
|
||||
{:ok, _user_relationship} = User.block(user, other_user)
|
||||
|
||||
{:ok, _, _} = CommonAPI.repeat(activity.id, other_user)
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
|
|||
blocker = insert(:user)
|
||||
blocked = insert(:user)
|
||||
user = insert(:user)
|
||||
{:ok, _user_block} = User.block(blocker, blocked)
|
||||
{:ok, _user_relationship} = User.block(blocker, blocked)
|
||||
|
||||
{:ok, _blocked_direct} =
|
||||
CommonAPI.post(blocked, %{
|
||||
|
|
|
|||
|
|
@ -191,11 +191,8 @@ 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_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)
|
||||
{:ok, _user_relationships} = User.mute(user, other_user, true)
|
||||
{:ok, _reblog_mute} = CommonAPI.hide_reblogs(user, other_user)
|
||||
|
||||
expected = %{
|
||||
id: to_string(other_user.id),
|
||||
|
|
@ -222,8 +219,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
|
||||
{:ok, user} = User.follow(user, other_user)
|
||||
{:ok, other_user} = User.subscribe(user, other_user)
|
||||
{:ok, _user_block} = User.block(user, other_user)
|
||||
{:ok, _user_block} = User.block(other_user, user)
|
||||
{:ok, _user_relationship} = User.block(user, other_user)
|
||||
{:ok, _user_relationship} = User.block(other_user, user)
|
||||
|
||||
expected = %{
|
||||
id: to_string(other_user.id),
|
||||
|
|
@ -294,7 +291,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
|
||||
other_user = insert(:user)
|
||||
{:ok, other_user} = User.follow(other_user, user)
|
||||
{:ok, _user_block} = User.block(other_user, user)
|
||||
{:ok, _user_relationship} = User.block(other_user, user)
|
||||
{:ok, _} = User.follow(insert(:user), user)
|
||||
|
||||
expected = %{
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
|||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, _user_mute} = User.mute(user, other_user)
|
||||
{:ok, _user_relationships} = 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_mute} = User.mute(user, other_user)
|
||||
{:ok, _user_relationships} = User.mute(user, other_user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(other_user, %{"status" => "test"})
|
||||
status = StatusView.render("show.json", %{activity: activity, for: user})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue