aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-16 20:05:21 +0300
committerAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-16 20:07:45 +0300
commitf3791add99014c4e5f1c51c06f8ace84b254cec2 (patch)
treecdb25d973f4b24c11a4dade08935f1d5a36f841e
parentac5c2b66b9f106bad117708cf74e3007c434d09e (diff)
downloadpleroma-f3791add99014c4e5f1c51c06f8ace84b254cec2.tar.gz
removing with_move parameter
-rw-r--r--CHANGELOG.md3
-rw-r--r--docs/API/differences_in_mastoapi_responses.md1
-rw-r--r--lib/pleroma/notification.ex9
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api.ex1
-rw-r--r--test/notification_test.exs8
-rw-r--r--test/web/activity_pub/activity_pub_test.exs6
-rw-r--r--test/web/mastodon_api/controllers/notification_controller_test.exs8
-rw-r--r--test/web/mastodon_api/views/notification_view_test.exs2
8 files changed, 10 insertions, 28 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4168086e2..e3be2ea08 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- **Breaking:** BBCode and Markdown formatters will no longer return any `\n` and only use `<br/>` for newlines
+### Removed
+- **Breaking:** removed `with_move` parameter from notifications timeline.
+
## [2.0.0] - 2019-03-08
### Security
- Mastodon API: Fix being able to request enourmous amount of statuses in timelines leading to DoS. Now limited to 40 per request.
diff --git a/docs/API/differences_in_mastoapi_responses.md b/docs/API/differences_in_mastoapi_responses.md
index 476a4a2bf..b12d3092c 100644
--- a/docs/API/differences_in_mastoapi_responses.md
+++ b/docs/API/differences_in_mastoapi_responses.md
@@ -117,7 +117,6 @@ The `type` value is `pleroma:emoji_reaction`. Has these fields:
Accepts additional parameters:
- `exclude_visibilities`: will exclude the notifications for activities with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`). Usage example: `GET /api/v1/notifications?exclude_visibilities[]=direct&exclude_visibilities[]=private`.
-- `with_move`: boolean, when set to `true` will include Move notifications. `false` by default.
## POST `/api/v1/statuses`
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index 60dba3434..3ef3b3f58 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -77,7 +77,6 @@ defmodule Pleroma.Notification do
|> exclude_notification_muted(user, exclude_notification_muted_opts)
|> exclude_blocked(user, exclude_blocked_opts)
|> exclude_visibility(opts)
- |> exclude_move(opts)
end
defp exclude_blocked(query, user, opts) do
@@ -107,14 +106,6 @@ defmodule Pleroma.Notification do
|> where([n, a, o, tm], is_nil(tm.user_id))
end
- defp exclude_move(query, %{with_move: true}) do
- query
- end
-
- defp exclude_move(query, _opts) do
- where(query, [n, a], fragment("?->>'type' != 'Move'", a.data))
- end
-
@valid_visibilities ~w[direct unlisted public private]
defp exclude_visibility(query, %{exclude_visibilities: visibility})
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api.ex b/lib/pleroma/web/mastodon_api/mastodon_api.ex
index 3fe2be521..a2dc9bc71 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api.ex
@@ -72,7 +72,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPI do
exclude_visibilities: {:array, :string},
reblogs: :boolean,
with_muted: :boolean,
- with_move: :boolean,
account_ap_id: :string
}
diff --git a/test/notification_test.exs b/test/notification_test.exs
index 56a581810..d240ede94 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -667,17 +667,13 @@ defmodule Pleroma.NotificationTest do
Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user)
ObanHelpers.perform_all()
- assert [] = Notification.for_user(follower)
-
assert [
%{
activity: %{
data: %{"type" => "Move", "actor" => ^old_ap_id, "target" => ^new_ap_id}
}
}
- ] = Notification.for_user(follower, %{with_move: true})
-
- assert [] = Notification.for_user(other_follower)
+ ] = Notification.for_user(follower)
assert [
%{
@@ -685,7 +681,7 @@ defmodule Pleroma.NotificationTest do
data: %{"type" => "Move", "actor" => ^old_ap_id, "target" => ^new_ap_id}
}
}
- ] = Notification.for_user(other_follower, %{with_move: true})
+ ] = Notification.for_user(other_follower)
end
end
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs
index 3dd3dd04d..d86c8260e 100644
--- a/test/web/activity_pub/activity_pub_test.exs
+++ b/test/web/activity_pub/activity_pub_test.exs
@@ -1955,11 +1955,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
activity = %Activity{activity | object: nil}
- assert [%Notification{activity: ^activity}] =
- Notification.for_user(follower, %{with_move: true})
+ assert [%Notification{activity: ^activity}] = Notification.for_user(follower)
- assert [%Notification{activity: ^activity}] =
- Notification.for_user(follower_move_opted_out, %{with_move: true})
+ assert [%Notification{activity: ^activity}] = Notification.for_user(follower_move_opted_out)
end
test "old user must be in the new user's `also_known_as` list" do
diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/web/mastodon_api/controllers/notification_controller_test.exs
index d452ddbdd..dbe9a7fd7 100644
--- a/test/web/mastodon_api/controllers/notification_controller_test.exs
+++ b/test/web/mastodon_api/controllers/notification_controller_test.exs
@@ -407,7 +407,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
assert length(json_response(conn, 200)) == 1
end
- test "see move notifications with `with_move` parameter" do
+ test "see move notifications" do
old_user = insert(:user)
new_user = insert(:user, also_known_as: [old_user.ap_id])
%{user: follower, conn: conn} = oauth_access(["read:notifications"])
@@ -416,11 +416,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user)
Pleroma.Tests.ObanHelpers.perform_all()
- ret_conn = get(conn, "/api/v1/notifications")
-
- assert json_response(ret_conn, 200) == []
-
- conn = get(conn, "/api/v1/notifications", %{"with_move" => "true"})
+ conn = get(conn, "/api/v1/notifications")
assert length(json_response(conn, 200)) == 1
end
diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/web/mastodon_api/views/notification_view_test.exs
index 4df9c3c03..d04c3022f 100644
--- a/test/web/mastodon_api/views/notification_view_test.exs
+++ b/test/web/mastodon_api/views/notification_view_test.exs
@@ -120,7 +120,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
old_user = refresh_record(old_user)
new_user = refresh_record(new_user)
- [notification] = Notification.for_user(follower, %{with_move: true})
+ [notification] = Notification.for_user(follower)
expected = %{
id: to_string(notification.id),