Add [:instances_favicons, :enabled] setting, defaults to false

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-07-08 05:56:24 +02:00
commit 312fc55f14
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
6 changed files with 53 additions and 6 deletions

View file

@ -5,6 +5,7 @@
defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
use Pleroma.DataCase
alias Pleroma.Config
alias Pleroma.User
alias Pleroma.UserRelationship
alias Pleroma.Web.CommonAPI
@ -18,6 +19,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
:ok
end
setup do: clear_config([:instances_favicons, :enabled])
test "Represent a user account" do
background_image = %{
"url" => [%{"href" => "https://example.com/images/asuka_hospital.png"}]
@ -94,6 +97,23 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert expected == AccountView.render("show.json", %{user: user})
end
test "Favicon is nil when :instances_favicons is disabled" do
user = insert(:user)
Config.put([:instances_favicons, :enabled], true)
assert %{
pleroma: %{
favicon:
"https://shitposter.club/plugins/Qvitter/img/gnusocial-favicons/favicon-16x16.png"
}
} = AccountView.render("show.json", %{user: user})
Config.put([:instances_favicons, :enabled], false)
assert %{pleroma: %{favicon: nil}} = AccountView.render("show.json", %{user: user})
end
test "Represent the user account for the account owner" do
user = insert(:user)