forked from potsda.mn/mobilizon
refactor: remove some outdated todos and legacy fallbacks
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
f7585cfc75
commit
428537df1f
|
@ -1163,14 +1163,10 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
|
|||
end
|
||||
end
|
||||
|
||||
# Before 1.0.4 the object of a "Remove" activity was an actor's URL
|
||||
# instead of the member's URL.
|
||||
# TODO: Remove in 1.2
|
||||
@spec get_remove_object(map() | String.t()) :: {:ok, integer()}
|
||||
defp get_remove_object(object) do
|
||||
case object |> Utils.get_url() |> ActivityPub.fetch_object_from_url() do
|
||||
{:ok, %Member{actor: %Actor{id: person_id}}} -> {:ok, person_id}
|
||||
{:ok, %Actor{id: person_id}} -> {:ok, person_id}
|
||||
_ -> {:error, :remove_object_not_found}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -76,14 +76,13 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
|
|||
def as_to_model_data(_), do: {:error, :actor_not_allowed_type}
|
||||
|
||||
defp add_endpoints_to_model(actor, data) do
|
||||
# TODO: Remove fallbacks in 3.0
|
||||
endpoints = %{
|
||||
members_url: get_in(data, ["endpoints", "members"]) || data["members"],
|
||||
resources_url: get_in(data, ["endpoints", "resources"]) || data["resources"],
|
||||
todos_url: get_in(data, ["endpoints", "todos"]) || data["todos"],
|
||||
events_url: get_in(data, ["endpoints", "events"]) || data["events"],
|
||||
posts_url: get_in(data, ["endpoints", "posts"]) || data["posts"],
|
||||
discussions_url: get_in(data, ["endpoints", "discussions"]) || data["discussions"],
|
||||
members_url: get_in(data, ["endpoints", "members"]),
|
||||
resources_url: get_in(data, ["endpoints", "resources"]),
|
||||
todos_url: get_in(data, ["endpoints", "todos"]),
|
||||
events_url: get_in(data, ["endpoints", "events"]),
|
||||
posts_url: get_in(data, ["endpoints", "posts"]),
|
||||
discussions_url: get_in(data, ["endpoints", "discussions"]),
|
||||
shared_inbox_url: data["endpoints"]["sharedInbox"]
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ defmodule Mobilizon.Discussions do
|
|||
|> join(:left, [c], r in Comment, on: r.origin_comment_id == c.id)
|
||||
|> where([c, _], is_nil(c.in_reply_to_comment_id))
|
||||
|> where([c], c.visibility in ^@public_visibility)
|
||||
# TODO: This was added because we don't want to count deleted comments in total_replies.
|
||||
# This was added because we don't want to count deleted comments in total_replies.
|
||||
# However, it also excludes all top-level comments with deleted replies from being selected
|
||||
# |> where([_, r], is_nil(r.deleted_at))
|
||||
|> group_by([c], c.id)
|
||||
|
|
|
@ -11,9 +11,7 @@ defmodule Mobilizon.Service.RichMedia.Parser do
|
|||
max_body: 2_000_000,
|
||||
timeout: 10_000,
|
||||
recv_timeout: 20_000,
|
||||
follow_redirect: true,
|
||||
# TODO: Remove me once Hackney/HTTPoison fixes their issue with TLS1.3 and OTP 23
|
||||
ssl: [{:versions, [:"tlsv1.2"]}]
|
||||
follow_redirect: true
|
||||
]
|
||||
|
||||
alias Mobilizon.Config
|
||||
|
|
|
@ -87,8 +87,6 @@ defmodule Mobilizon.Web.Email.Group do
|
|||
end
|
||||
end
|
||||
|
||||
# TODO : def send_confirmation_to_inviter()
|
||||
|
||||
@member_roles [:administrator, :moderator, :member]
|
||||
@spec send_group_suspension_notification(Member.t()) :: :ok
|
||||
def send_group_suspension_notification(%Member{actor: %Actor{user_id: nil}}), do: :ok
|
||||
|
|
|
@ -124,6 +124,4 @@ defmodule Mobilizon.Web.Email.Member do
|
|||
:ok
|
||||
end
|
||||
end
|
||||
|
||||
# TODO : def send_confirmation_to_inviter()
|
||||
end
|
||||
|
|
|
@ -71,13 +71,7 @@ defmodule Mobilizon.Web.MediaProxy do
|
|||
@compile {:no_warn_undefined, {:crypto, :mac, 4}}
|
||||
@compile {:no_warn_undefined, {:crypto, :hmac, 3}}
|
||||
defp sha_hmac(key, url) do
|
||||
# :crypto.hmac was removed in OTP24, but :crypto.mac was added in OTP 22.1
|
||||
# TODO: Remove me when we don't support OTP 21/22 anymore
|
||||
if function_exported?(:crypto, :mac, 4) do
|
||||
:crypto.mac(:hmac, :sha, key, url)
|
||||
else
|
||||
:crypto.hmac(:sha, key, url)
|
||||
end
|
||||
:crypto.mac(:hmac, :sha, key, url)
|
||||
end
|
||||
|
||||
@spec filename(String.t()) :: String.t() | nil
|
||||
|
|
Loading…
Reference in a new issue