summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--config/config.exs1
-rw-r--r--config/description.exs17
-rw-r--r--docs/API/admin_api.md16
-rw-r--r--docs/admin/config.md84
-rw-r--r--docs/administration/CLI_tasks/config.md18
-rw-r--r--docs/configuration/cheatsheet.md3
-rw-r--r--lib/pleroma/formatter.ex3
-rw-r--r--lib/pleroma/web/admin_api/admin_api_controller.ex95
-rw-r--r--lib/pleroma/web/common_api/common_api.ex3
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex4
-rw-r--r--lib/pleroma/web/mastodon_api/views/poll_view.ex3
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex19
-rw-r--r--lib/pleroma/web/router.ex1
-rw-r--r--test/web/admin_api/admin_api_controller_test.exs51
-rw-r--r--test/web/common_api/common_api_test.exs15
-rw-r--r--test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs4
-rw-r--r--test/web/mastodon_api/views/account_view_test.exs4
18 files changed, 90 insertions, 256 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 713ae4361..b470b74ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **Breaking**: OStatus protocol support
- **Breaking**: MDII uploader
- **Breaking**: Using third party engines for user recommendation
+<details>
+ <summary>API Changes</summary>
+- **Breaking**: AdminAPI: migrate_from_db endpoint
+</details>
### Changed
- **Breaking:** Pleroma won't start if it detects unapplied migrations
@@ -38,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **Breaking:** Admin API: `PUT /api/pleroma/admin/reports/:id` is now `PATCH /api/pleroma/admin/reports`, see admin_api.md for details
- **Breaking:** `/api/pleroma/admin/users/invite_token` now uses `POST`, changed accepted params and returns full invite in json instead of only token string.
- **Breaking** replying to reports is now "report notes", enpoint changed from `POST /api/pleroma/admin/reports/:id/respond` to `POST /api/pleroma/admin/reports/:id/notes`
+- Mastodon API: stopped sanitizing display names, field names and subject fields since they are supposed to be treated as plaintext
- Admin API: Return `total` when querying for reports
- Mastodon API: Return `pleroma.direct_conversation_id` when creating a direct message (`POST /api/v1/statuses`)
- Admin API: Return link alongside with token on password reset
diff --git a/config/config.exs b/config/config.exs
index 60c982557..34716cf37 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -509,7 +509,6 @@ config :pleroma, :fetch_initial_posts,
config :auto_linker,
opts: [
- scheme: true,
extra: true,
# TODO: Set to :no_scheme when it works properly
validate_tld: true,
diff --git a/config/description.exs b/config/description.exs
index 1ffb66287..6b912a07e 100644
--- a/config/description.exs
+++ b/config/description.exs
@@ -871,7 +871,7 @@ config :pleroma, :config_description, [
},
%{
key: :limit_to_local_content,
- type: [:atom, false],
+ type: {:dropdown, :atom},
description:
"Limit unauthenticated users to search for local statutes and users only. Default: `:unauthenticated`.",
suggestions: [
@@ -942,7 +942,7 @@ config :pleroma, :config_description, [
children: [
%{
key: :level,
- type: :atom,
+ type: {:dropdown, :atom},
description: "Log level",
suggestions: [:debug, :info, :warn, :error]
},
@@ -974,7 +974,7 @@ config :pleroma, :config_description, [
children: [
%{
key: :level,
- type: :atom,
+ type: {:dropdown, :atom},
description: "Log level",
suggestions: [:debug, :info, :warn, :error]
},
@@ -998,7 +998,7 @@ config :pleroma, :config_description, [
children: [
%{
key: :level,
- type: :atom,
+ type: {:dropdown, :atom},
description: "Log level",
suggestions: [:debug, :info, :warn, :error]
},
@@ -1969,7 +1969,7 @@ config :pleroma, :config_description, [
},
%{
key: :verbose,
- type: [:atom, false],
+ type: {:dropdown, :atom},
description: "Logs verbose mode",
suggestions: [false, :error, :warn, :info, :debug]
},
@@ -2178,12 +2178,7 @@ config :pleroma, :config_description, [
%{
key: :new_window,
type: :boolean,
- description: "Set to `false` to remove target='_blank' attribute"
- },
- %{
- key: :scheme,
- type: :boolean,
- description: "Set to `true` to link urls with schema http://google.com"
+ description: "Link urls will open in new window/tab"
},
%{
key: :truncate,
diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md
index 2c0c5f46b..fb6dfcb08 100644
--- a/docs/API/admin_api.md
+++ b/docs/API/admin_api.md
@@ -678,21 +678,6 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
{}
```
-## `GET /api/pleroma/admin/config/migrate_from_db`
-
-### Run mix task pleroma.config migrate_from_db
-
-Copies all settings from database to `config/{env}.exported_from_db.secret.exs` with deletion from the table. Where `{env}` is the environment in which `pleroma` is running.
-
-- Params: none
-- Response:
- - On failure:
- - 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
-
-```json
-{}
-```
-
## `GET /api/pleroma/admin/config`
### Get list of merged default settings with saved in database.
@@ -704,7 +689,6 @@ Copies all settings from database to `config/{env}.exported_from_db.secret.exs`
- Response:
- On failure:
- 400 Bad Request `"To use this endpoint you need to enable configuration from database."`
- - 400 Bad Request `"To use configuration from database migrate your settings to database."`
```json
{
diff --git a/docs/admin/config.md b/docs/admin/config.md
deleted file mode 100644
index b39a73961..000000000
--- a/docs/admin/config.md
+++ /dev/null
@@ -1,84 +0,0 @@
-# Configuring instance
-You can configure your instance from admin interface. You need account with admin rights and little change in config file, which will allow settings configuration from database.
-
-```elixir
-config :pleroma, configurable_from_database: true
-```
-
-## How it works
-Settings are stored in database and are applied in `runtime` after each change. Most of the settings take effect immediately, except some, which need instance reboot.
-
-## How to set it up
-You need to migrate your existing settings to the database. This task will migrate only added by user settings.
-For example you add settings to `prod.secret.exs` file, only these settings will be migrated to database. For release it will be `/etc/pleroma/config.exs` or `PLEROMA_CONFIG_PATH`.
-You can do this with mix task (all config files will remain untouched):
-
-```sh tab="OTP"
- ./bin/pleroma_ctl config migrate_to_db
-```
-
-```sh tab="From Source"
-mix pleroma.config migrate_to_db
-```
-
-Now you can change settings in admin interface. If `reboot time` settings were changed, pleroma must be rebooted.
-
-<span style="color:red">**ATTENTION**</span>
-
-**<span style="color:red">Be careful while changing the settings. Every inaccurate configuration change can break the federation or the instance load.</span>**
-
-*Compile time settings, which require instance reboot and can break instance loading:*
-- all settings inside these keys:
- - `:hackney_pools`
- - `:chat`
- - `Oban`
- - `:rate_limit`
- - `:markup`
- - `:streamer`
-- partially settings inside these keys:
- - `:seconds_valid` in `Pleroma.Captcha`
- - `:proxy_remote` in `Pleroma.Upload`
- - `:upload_limit` in `:instance`
- - `:digest` in `:email_notifications`
- - `:clean_expired_tokens` in `:oauth2`
- - `:enabled` in `Pleroma.ActivityExpiration`
- - `:enabled` in `Pleroma.ScheduledActivity`
- - `:enabled` in `:gopher`
-
-## How to dump settings from database to file
-
-*Adding `-d` flag will delete migrated settings from database table.*
-
-```sh tab="OTP"
- ./bin/pleroma_ctl config migrate_from_db [-d]
-```
-
-```sh tab="From Source"
-mix pleroma.config migrate_from_db [-d]
-```
-
-
-## How to completely remove it
-
-1. Truncate or delete all values from `config` table
-```sql
-TRUNCATE TABLE config;
-```
-2. If migrate_from_db task was runned, backup and delete `config/{env}.exported_from_db.exs`.
-
-For `prod` env:
-```bash
-cd /opt/pleroma
-cp config/prod.exported_from_db.exs config/exported_from_db.back
-rm -rf config/prod.exported_from_db.exs
-```
-*If you don't want to backup settings, you can skip step with `cp` command.*
-
-3. Set configurable_from_database to `false`.
-```elixir
-config :pleroma, configurable_from_database: false
-```
-4. Restart pleroma instance
-```bash
-sudo service pleroma restart
-```
diff --git a/docs/administration/CLI_tasks/config.md b/docs/administration/CLI_tasks/config.md
index 2af51c247..873775962 100644
--- a/docs/administration/CLI_tasks/config.md
+++ b/docs/administration/CLI_tasks/config.md
@@ -1,12 +1,16 @@
# Transfering the config to/from the database
-!!! danger
- This is a Work In Progress, not usable just yet.
-
{! backend/administration/CLI_tasks/general_cli_task_info.include !}
## Transfer config from file to DB.
+!!! note
+ You need to add the following to your config before executing this command:
+
+ ```elixir
+ config :pleroma, configurable_from_database: true
+ ```
+
```sh tab="OTP"
./bin/pleroma_ctl config migrate_to_db
```
@@ -18,7 +22,15 @@ mix pleroma.config migrate_to_db
## Transfer config from DB to `config/env.exported_from_db.secret.exs`
+!!! note
+ In-Database configuration will still be applied after executing this command unless you set the following in your config:
+
+ ```elixir
+ config :pleroma, configurable_from_database: false
+ ```
+
To delete transfered settings from database optional flag `-d` can be used. <env> is `prod` by default.
+
```sh tab="OTP"
./bin/pleroma_ctl config migrate_from_db [--env=<env>] [-d]
```
diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md
index ed9049a8d..f30aedc01 100644
--- a/docs/configuration/cheatsheet.md
+++ b/docs/configuration/cheatsheet.md
@@ -856,4 +856,5 @@ config :auto_linker,
## :configurable_from_database
-Enable/disable configuration from database.
+
+Boolean, enables/disables in-database configuration. Read [Transfering the config to/from the database](../administration/CLI_tasks/config.md) for more information.
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex
index 19b9af46c..90895374d 100644
--- a/lib/pleroma/formatter.ex
+++ b/lib/pleroma/formatter.ex
@@ -13,7 +13,8 @@ defmodule Pleroma.Formatter do
@auto_linker_config hashtag: true,
hashtag_handler: &Pleroma.Formatter.hashtag_handler/4,
mention: true,
- mention_handler: &Pleroma.Formatter.mention_handler/4
+ mention_handler: &Pleroma.Formatter.mention_handler/4,
+ scheme: true
def escape_mention_handler("@" <> nickname = mention, buffer, _, _) do
case User.get_cached_by_nickname(nickname) do
diff --git a/lib/pleroma/web/admin_api/admin_api_controller.ex b/lib/pleroma/web/admin_api/admin_api_controller.ex
index 6f0449418..c95cd182d 100644
--- a/lib/pleroma/web/admin_api/admin_api_controller.ex
+++ b/lib/pleroma/web/admin_api/admin_api_controller.ex
@@ -97,7 +97,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
plug(
OAuthScopesPlug,
%{scopes: ["read"], admin: true}
- when action in [:config_show, :migrate_from_db, :list_log]
+ when action in [:config_show, :list_log]
)
plug(
@@ -793,33 +793,13 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|> Plug.Conn.send_resp(200, @descriptions_json)
end
- def migrate_from_db(conn, _params) do
- with :ok <- configurable_from_database(conn) do
- Mix.Tasks.Pleroma.Config.run([
- "migrate_from_db",
- "--env",
- to_string(Pleroma.Config.get(:env)),
- "-d"
- ])
-
- json(conn, %{})
- end
- end
-
def config_show(conn, %{"only_db" => true}) do
with :ok <- configurable_from_database(conn) do
configs = Pleroma.Repo.all(ConfigDB)
- if configs == [] do
- errors(
- conn,
- {:error, "To use configuration from database migrate your settings to database."}
- )
- else
- conn
- |> put_view(ConfigView)
- |> render("index.json", %{configs: configs})
- end
+ conn
+ |> put_view(ConfigView)
+ |> render("index.json", %{configs: configs})
end
end
@@ -827,45 +807,38 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
with :ok <- configurable_from_database(conn) do
configs = ConfigDB.get_all_as_keyword()
- if configs == [] do
- errors(
- conn,
- {:error, "To use configuration from database migrate your settings to database."}
- )
- else
- merged =
- Pleroma.Config.Holder.config()
- |> ConfigDB.merge(configs)
- |> Enum.map(fn {group, values} ->
- Enum.map(values, fn {key, value} ->
- db =
- if configs[group][key] do
- ConfigDB.get_db_keys(configs[group][key], key)
- end
-
- db_value = configs[group][key]
-
- merged_value =
- if !is_nil(db_value) and Keyword.keyword?(db_value) and
- ConfigDB.sub_key_full_update?(group, key, Keyword.keys(db_value)) do
- ConfigDB.merge_group(group, key, value, db_value)
- else
- value
- end
-
- setting = %{
- group: ConfigDB.convert(group),
- key: ConfigDB.convert(key),
- value: ConfigDB.convert(merged_value)
- }
-
- if db, do: Map.put(setting, :db, db), else: setting
- end)
+ merged =
+ Pleroma.Config.Holder.config()
+ |> ConfigDB.merge(configs)
+ |> Enum.map(fn {group, values} ->
+ Enum.map(values, fn {key, value} ->
+ db =
+ if configs[group][key] do
+ ConfigDB.get_db_keys(configs[group][key], key)
+ end
+
+ db_value = configs[group][key]
+
+ merged_value =
+ if !is_nil(db_value) and Keyword.keyword?(db_value) and
+ ConfigDB.sub_key_full_update?(group, key, Keyword.keys(db_value)) do
+ ConfigDB.merge_group(group, key, value, db_value)
+ else
+ value
+ end
+
+ setting = %{
+ group: ConfigDB.convert(group),
+ key: ConfigDB.convert(key),
+ value: ConfigDB.convert(merged_value)
+ }
+
+ if db, do: Map.put(setting, :db, db), else: setting
end)
- |> List.flatten()
+ end)
+ |> List.flatten()
- json(conn, %{configs: merged})
- end
+ json(conn, %{configs: merged})
end
end
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index c05a6c544..2a348dcf6 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -315,8 +315,9 @@ defmodule Pleroma.Web.CommonAPI do
with %Activity{
actor: ^user_ap_id,
data: %{"type" => "Create"},
- object: %Object{data: %{"type" => "Note"}}
+ object: %Object{data: %{"type" => object_type}}
} = activity <- get_by_id_or_ap_id(id_or_ap_id),
+ true <- object_type in ["Note", "Article", "Question"],
true <- Visibility.is_public?(activity),
{:ok, _user} <- User.add_pinnned_activity(user, activity) do
{:ok, activity}
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index a5420f480..c6d37ead7 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -67,7 +67,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
end
defp do_render("show.json", %{user: user} = opts) do
- display_name = HTML.strip_tags(user.name || user.nickname)
+ display_name = user.name || user.nickname
image = User.avatar_url(user) |> MediaProxy.url()
header = User.banner_url(user) |> MediaProxy.url()
@@ -105,7 +105,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|> User.fields()
|> Enum.map(fn %{"name" => name, "value" => value} ->
%{
- "name" => Pleroma.HTML.strip_tags(name),
+ "name" => name,
"value" => Pleroma.HTML.filter_tags(value, Pleroma.HTML.Scrubber.LinksOnly)
}
end)
diff --git a/lib/pleroma/web/mastodon_api/views/poll_view.ex b/lib/pleroma/web/mastodon_api/views/poll_view.ex
index 753039da3..6bb3652fb 100644
--- a/lib/pleroma/web/mastodon_api/views/poll_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/poll_view.ex
@@ -5,7 +5,6 @@
defmodule Pleroma.Web.MastodonAPI.PollView do
use Pleroma.Web, :view
- alias Pleroma.HTML
alias Pleroma.Web.CommonAPI.Utils
def render("show.json", %{object: object, multiple: multiple, options: options} = params) do
@@ -57,7 +56,7 @@ defmodule Pleroma.Web.MastodonAPI.PollView do
current_count = option["replies"]["totalItems"] || 0
{%{
- title: HTML.strip_tags(name),
+ title: name,
votes_count: current_count
}, current_count + count}
end)
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 5df29d93f..6cb158bbf 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -216,21 +216,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
summary = object.data["summary"] || ""
- summary_html =
- summary
- |> HTML.get_cached_scrubbed_html_for_activity(
- User.html_filter_policy(opts[:for]),
- activity,
- "mastoapi:summary"
- )
-
- summary_plaintext =
- summary
- |> HTML.get_cached_stripped_html_for_activity(
- activity,
- "mastoapi:summary"
- )
-
card = render("card.json", Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity))
url =
@@ -286,7 +271,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
muted: thread_muted? || User.mutes?(opts[:for], user),
pinned: pinned?(activity, user),
sensitive: sensitive,
- spoiler_text: summary_html,
+ spoiler_text: summary,
visibility: get_visibility(object),
media_attachments: attachments,
poll: render(PollView, "show.json", object: object, for: opts[:for]),
@@ -303,7 +288,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
conversation_id: get_context_id(activity),
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname,
content: %{"text/plain" => content_plaintext},
- spoiler_text: %{"text/plain" => summary_plaintext},
+ spoiler_text: %{"text/plain" => summary},
expires_at: expires_at,
direct_conversation_id: direct_conversation_id,
thread_muted: thread_muted?,
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex
index 078bf138c..e86bc3cc3 100644
--- a/lib/pleroma/web/router.ex
+++ b/lib/pleroma/web/router.ex
@@ -196,7 +196,6 @@ defmodule Pleroma.Web.Router do
get("/config", AdminAPIController, :config_show)
post("/config", AdminAPIController, :config_update)
get("/config/descriptions", AdminAPIController, :config_descriptions)
- get("/config/migrate_from_db", AdminAPIController, :migrate_from_db)
get("/restart", AdminAPIController, :restart)
get("/moderation_log", AdminAPIController, :list_log)
diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs
index 81e346fb8..5fbdf96f6 100644
--- a/test/web/admin_api/admin_api_controller_test.exs
+++ b/test/web/admin_api/admin_api_controller_test.exs
@@ -1899,13 +1899,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
"To use this endpoint you need to enable configuration from database."
end
- test "without any settings in db", %{conn: conn} do
- conn = get(conn, "/api/pleroma/admin/config")
-
- assert json_response(conn, 400) ==
- "To use configuration from database migrate your settings to database."
- end
-
test "with settings only in db", %{conn: conn} do
config1 = insert(:config)
config2 = insert(:config)
@@ -2984,50 +2977,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
end
end
- describe "config mix tasks run" do
- setup do
- Mix.shell(Mix.Shell.Quiet)
-
- on_exit(fn ->
- Mix.shell(Mix.Shell.IO)
- end)
-
- :ok
- end
-
- clear_config(:configurable_from_database) do
- Pleroma.Config.put(:configurable_from_database, true)
- end
-
- clear_config([:feed, :post_title]) do
- Pleroma.Config.put([:feed, :post_title], %{max_length: 100, omission: "…"})
- end
-
- test "transfer settings to DB and to file", %{conn: conn} do
- assert Repo.all(Pleroma.ConfigDB) == []
- Mix.Tasks.Pleroma.Config.migrate_to_db("test/fixtures/config/temp.secret.exs")
- assert Repo.aggregate(Pleroma.ConfigDB, :count, :id) > 0
-
- conn = get(conn, "/api/pleroma/admin/config/migrate_from_db")
-
- assert json_response(conn, 200) == %{}
- assert Repo.all(Pleroma.ConfigDB) == []
- end
-
- test "returns error if configuration from database is off", %{conn: conn} do
- initial = Pleroma.Config.get(:configurable_from_database)
- on_exit(fn -> Pleroma.Config.put(:configurable_from_database, initial) end)
- Pleroma.Config.put(:configurable_from_database, false)
-
- conn = get(conn, "/api/pleroma/admin/config/migrate_from_db")
-
- assert json_response(conn, 400) ==
- "To use this endpoint you need to enable configuration from database."
-
- assert Repo.all(Pleroma.ConfigDB) == []
- end
- end
-
describe "GET /api/pleroma/admin/restart" do
clear_config(:configurable_from_database) do
Pleroma.Config.put(:configurable_from_database, true)
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 8fa0c6faa..214cbdd7c 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -324,6 +324,21 @@ defmodule Pleroma.Web.CommonAPITest do
assert %User{pinned_activities: [^id]} = user
end
+ test "pin poll", %{user: user} do
+ {:ok, activity} =
+ CommonAPI.post(user, %{
+ "status" => "How is fediverse today?",
+ "poll" => %{"options" => ["Absolutely outstanding", "Not good"], "expires_in" => 20}
+ })
+
+ assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
+
+ id = activity.id
+ user = refresh_record(user)
+
+ assert %User{pinned_activities: [^id]} = user
+ end
+
test "unlisted statuses can be pinned", %{user: user} do
{:ok, activity} = CommonAPI.post(user, %{"status" => "HI!!!", "visibility" => "unlisted"})
assert {:ok, ^activity} = CommonAPI.pin(activity.id, user)
diff --git a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs
index 09bdc46e0..82d9e7d2f 100644
--- a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs
+++ b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs
@@ -269,7 +269,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
|> json_response(200)
assert account_data["fields"] == [
- %{"name" => "foo", "value" => "bar"},
+ %{"name" => "<a href=\"http://google.com\">foo</a>", "value" => "bar"},
%{"name" => "link", "value" => ~S(<a href="http://cofe.io" rel="ugc">cofe.io</a>)}
]
@@ -297,7 +297,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
|> json_response(200)
assert account["fields"] == [
- %{"name" => "foo", "value" => "bar"},
+ %{"name" => "<a href=\"http://google.com\">foo</a>", "value" => "bar"},
%{"name" => "link", "value" => ~S(<a href="http://cofe.io" rel="ugc">cofe.io</a>)}
]
diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs
index 2107bb85c..00c294845 100644
--- a/test/web/mastodon_api/views/account_view_test.exs
+++ b/test/web/mastodon_api/views/account_view_test.exs
@@ -368,10 +368,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert result.pleroma[:settings_store] == nil
end
- test "sanitizes display names" do
+ test "doesn't sanitize display names" do
user = insert(:user, name: "<marquee> username </marquee>")
result = AccountView.render("show.json", %{user: user})
- refute result.display_name == "<marquee> username </marquee>"
+ assert result.display_name == "<marquee> username </marquee>"
end
test "never display nil user follow counts" do