Remove legacy nip_ee_mls feature-gating code
This commit is contained in:
@@ -30,7 +30,6 @@ defmodule Parrhesia.Policy.EventPolicy do
|
||||
| :pow_below_minimum
|
||||
| :pubkey_banned
|
||||
| :event_banned
|
||||
| :mls_disabled
|
||||
|
||||
@spec authorize_read([map()], MapSet.t(String.t())) :: :ok | {:error, policy_error()}
|
||||
def authorize_read(filters, authenticated_pubkeys) when is_list(filters) do
|
||||
@@ -57,8 +56,7 @@ defmodule Parrhesia.Policy.EventPolicy do
|
||||
fn -> enforce_pow(event) end,
|
||||
fn -> enforce_protected_event(event, authenticated_pubkeys) end,
|
||||
fn -> enforce_media_metadata_policy(event) end,
|
||||
fn -> enforce_push_notification_policy(event) end,
|
||||
fn -> enforce_mls_feature_flag(event) end
|
||||
fn -> enforce_push_notification_policy(event) end
|
||||
]
|
||||
|
||||
Enum.reduce_while(checks, :ok, fn check, :ok ->
|
||||
@@ -135,7 +133,6 @@ defmodule Parrhesia.Policy.EventPolicy do
|
||||
def error_message(:pow_below_minimum), do: "pow: minimum proof-of-work difficulty not met"
|
||||
def error_message(:pubkey_banned), do: "blocked: pubkey is banned"
|
||||
def error_message(:event_banned), do: "blocked: event is banned"
|
||||
def error_message(:mls_disabled), do: "blocked: mls feature flag is disabled"
|
||||
|
||||
defp maybe_require_auth_for_write(authenticated_pubkeys) do
|
||||
if config_bool([:policies, :auth_required_for_writes], false) and
|
||||
@@ -651,14 +648,6 @@ defmodule Parrhesia.Policy.EventPolicy do
|
||||
end
|
||||
end
|
||||
|
||||
defp enforce_mls_feature_flag(event) do
|
||||
if event["kind"] in [443, 445, 10_051] and not config_bool([:features, :nip_ee_mls], false) do
|
||||
{:error, :mls_disabled}
|
||||
else
|
||||
:ok
|
||||
end
|
||||
end
|
||||
|
||||
defp config_bool([scope, key], default) do
|
||||
case Application.get_env(:parrhesia, scope, []) |> Keyword.get(key, default) do
|
||||
true -> true
|
||||
|
||||
@@ -855,12 +855,12 @@ defmodule Parrhesia.Storage.Adapters.Postgres.Events do
|
||||
defp parse_unix_seconds(_unix_seconds), do: nil
|
||||
|
||||
defp maybe_apply_mls_group_retention(nil, 445, created_at) do
|
||||
if Application.get_env(:parrhesia, :features, []) |> Keyword.get(:nip_ee_mls, false) do
|
||||
ttl =
|
||||
:parrhesia
|
||||
|> Application.get_env(:policies, [])
|
||||
|> Keyword.get(:mls_group_event_ttl_seconds, 300)
|
||||
ttl =
|
||||
:parrhesia
|
||||
|> Application.get_env(:policies, [])
|
||||
|> Keyword.get(:mls_group_event_ttl_seconds, 300)
|
||||
|
||||
if is_integer(ttl) and ttl > 0 do
|
||||
created_at + ttl
|
||||
else
|
||||
nil
|
||||
|
||||
@@ -443,8 +443,7 @@ defmodule Parrhesia.Web.Connection do
|
||||
:push_notification_replay_window_exceeded,
|
||||
:push_notification_missing_expiration,
|
||||
:push_notification_expiration_too_far,
|
||||
:push_notification_server_recipients_exceeded,
|
||||
:mls_disabled
|
||||
:push_notification_server_recipients_exceeded
|
||||
],
|
||||
do: EventPolicy.error_message(reason)
|
||||
|
||||
|
||||
@@ -37,15 +37,6 @@ defmodule Parrhesia.Web.RelayInfo do
|
||||
86,
|
||||
98
|
||||
]
|
||||
|> maybe_add_mls()
|
||||
end
|
||||
|
||||
defp maybe_add_mls(nips) do
|
||||
if Parrhesia.Config.get([:features, :nip_ee_mls], false) do
|
||||
["EE" | nips]
|
||||
else
|
||||
nips
|
||||
end
|
||||
end
|
||||
|
||||
defp limitations do
|
||||
|
||||
Reference in New Issue
Block a user