author = Keyword.get(options, :author)
search_function =
- if Application.get_env(:postgres, :version) >= 11 do
+ if :persistent_term.get({Pleroma.Repo, :postgres_version}) >= 11 do
:websearch
else
:plain
9.6
end
- Application.put_env(:postgres, :version, version)
+ :persistent_term.put({Pleroma.Repo, :postgres_version}, version)
end
def load_custom_modules do
end
test "using plainto_tsquery on postgres < 11" do
- old_config = Application.get_env(:postgres, :version)
- Application.put_env(:postgres, :version, 10.0)
+ old_version = :persistent_term.get({Pleroma.Repo, :postgres_version})
+ :persistent_term.put({Pleroma.Repo, :postgres_version}, 10.0)
user = insert(:user)
{:ok, post} = CommonAPI.post(user, %{status: "it's wednesday my dudes"})
assert result.id == post.id
- Application.put_env(:postgres, :version, old_config)
+ :persistent_term.put({Pleroma.Repo, :postgres_version}, old_version)
end
test "using websearch_to_tsquery" do
end
test "search fetches remote statuses and prefers them over other results", %{conn: conn} do
- old_config = Application.get_env(:postgres, :version)
- Application.put_env(:postgres, :version, 10.0)
+ old_version = :persistent_term.get({Pleroma.Repo, :postgres_version})
+ :persistent_term.put({Pleroma.Repo, :postgres_version}, 10.0)
capture_log(fn ->
{:ok, %{id: activity_id}} =
] = results["statuses"]
end)
- Application.put_env(:postgres, :version, old_config)
+ :persistent_term.put({Pleroma.Repo, :postgres_version}, old_version)
end
test "search doesn't show statuses that it shouldn't", %{conn: conn} do