aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Joshi <satchin.joshi@gmail.com>2019-05-13 23:50:33 +0545
committerSachin Joshi <satchin.joshi@gmail.com>2019-05-14 00:13:15 +0545
commit7701a4c84191a445e0b62e8a241e8af86f86e16a (patch)
treeb17517c7bfe0829f3ab31c52399edad451dedf9d
parent16cb9e5f1cae84322bd7953e58b438f3b4bd8b9c (diff)
downloadpleroma-7701a4c84191a445e0b62e8a241e8af86f86e16a.tar.gz
Make irreversible field default to false in filters
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex2
-rw-r--r--priv/repo/migrations/20190513175809_change_hide_column_in_filter_table.exs9
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs1
4 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9c9538b0..76e6f6b39 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -92,6 +92,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Mastodon API: Handling of `reblogs` in `/api/v1/accounts/:id/follow`
- Mastodon API: Correct `reblogged`, `favourited`, and `bookmarked` values in the reblog status JSON
- Mastodon API: Exposing default scope of the user to anyone
+- Mastodon API: Make `irreversible` field default to `false` [`POST /api/v1/filters`]
## [0.9.9999] - 2019-04-05
### Security
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index 956736780..fd595031d 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -1536,7 +1536,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
user_id: user.id,
phrase: phrase,
context: context,
- hide: Map.get(params, "irreversible", nil),
+ hide: Map.get(params, "irreversible", false),
whole_word: Map.get(params, "boolean", true)
# expires_at
}
diff --git a/priv/repo/migrations/20190513175809_change_hide_column_in_filter_table.exs b/priv/repo/migrations/20190513175809_change_hide_column_in_filter_table.exs
new file mode 100644
index 000000000..2ffb88cc9
--- /dev/null
+++ b/priv/repo/migrations/20190513175809_change_hide_column_in_filter_table.exs
@@ -0,0 +1,9 @@
+defmodule Pleroma.Repo.Migrations.ChangeHideColumnInFilterTable do
+ use Ecto.Migration
+
+ def change do
+ alter table(:filters) do
+ modify :hide, :boolean, default: false
+ end
+ end
+end
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 505e45010..537cd98d5 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -572,6 +572,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert response = json_response(conn, 200)
assert response["phrase"] == filter.phrase
assert response["context"] == filter.context
+ assert response["irreversible"] == false
assert response["id"] != nil
assert response["id"] != ""
end