Typespec fixes and refactoring
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user