Make irreversible field default to false in filters
authorSachin Joshi <satchin.joshi@gmail.com>
Mon, 13 May 2019 18:05:33 +0000 (23:50 +0545)
committerSachin Joshi <satchin.joshi@gmail.com>
Mon, 13 May 2019 18:28:15 +0000 (00:13 +0545)
CHANGELOG.md
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
priv/repo/migrations/20190513175809_change_hide_column_in_filter_table.exs [new file with mode: 0644]
test/web/mastodon_api/mastodon_api_controller_test.exs

index b9c9538b070e4601f416f656c853f35509c460c5..76e6f6b394f7ce3111f1a20a6864d9f76ed4316a 100644 (file)
@@ -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
index 956736780bc321d1135ba35424821288d4962e0f..fd595031daf57905cd3250aec46bf7a1ac917604 100644 (file)
@@ -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 (file)
index 0000000..2ffb88c
--- /dev/null
@@ -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
index 505e450106b637b548e8ce83464946b7e1b8d97b..537cd98d56300e7d791539d492bfc24d9e66a396 100644 (file)
@@ -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