Typespec fixes and refactoring

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-05-03 12:23:09 +02:00
parent f6a17d8b3a
commit 999a33c7c3
10 changed files with 28 additions and 30 deletions

View File

@@ -29,7 +29,7 @@ defmodule Mobilizon.Service.Activity.Renderer do
@type common_render :: %{body: String.t(), url: String.t()}
@callback render(entity :: Activity.t(), Keyword.t()) :: common_render()
@callback render(activity :: Activity.t(), Keyword.t()) :: common_render()
@spec render(Activity.t()) :: render()
def render(%Activity{} = activity, options \\ []) do

View File

@@ -72,7 +72,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMaps do
end
end
@spec build_url(:search | :geocode, map(), list()) :: String.t() | no_return
@spec build_url(:search | :geocode | :place_details, map(), list()) :: String.t() | no_return
defp build_url(method, args, options) do
limit = Keyword.get(options, :limit, 10)
lang = Keyword.get(options, :lang, "en")

View File

@@ -289,7 +289,7 @@ defmodule Mobilizon.Service.Notifications.Scheduler do
{:ok, nil}
# Sending to calculated time
true ->
match?(%DateTime{}, send_at) ->
Notification.enqueue(:pending_membership_notification, params, scheduled_at: send_at)
end
end

View File

@@ -73,7 +73,7 @@ defmodule Mobilizon.Service.Notifier.Push do
Map.get(@default_behavior, activity_setting, false)
end
@spec send_subscription(Activity.t(), any, Keyword.t()) :: no_return
@spec send_subscription(Activity.t(), any, Keyword.t()) :: any()
defp send_subscription(activity, subscription, options) do
activity
|> payload(options)

View File

@@ -41,7 +41,7 @@ defmodule Mobilizon.Service.Workers.Helper do
alias Oban.Job
@spec enqueue(String.t() | :atom, map(), Keyword.t()) ::
@spec enqueue(String.t() | atom(), map(), Keyword.t()) ::
{:ok, Job.t()} | {:error, Ecto.Changeset.t()}
def enqueue(operation, params, worker_args \\ []) do
params = Map.merge(%{"op" => operation}, params)