summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mix/pleroma.ex13
-rw-r--r--lib/pleroma/config/transfer_task.ex6
-rw-r--r--lib/pleroma/moderation_log.ex76
-rw-r--r--lib/pleroma/web/common_api/utils.ex2
4 files changed, 19 insertions, 78 deletions
diff --git a/lib/mix/pleroma.ex b/lib/mix/pleroma.ex
index 90f8c8008..3ad6edbfb 100644
--- a/lib/mix/pleroma.ex
+++ b/lib/mix/pleroma.ex
@@ -12,6 +12,19 @@ defmodule Mix.Pleroma do
end
{:ok, _} = Application.ensure_all_started(:pleroma)
+
+ if Pleroma.Config.get(:env) not in [:test, :benchmark] do
+ pleroma_rebooted?()
+ end
+ end
+
+ defp pleroma_rebooted? do
+ if Restarter.Pleroma.rebooted?() do
+ :ok
+ else
+ Process.sleep(10)
+ pleroma_rebooted?()
+ end
end
def load_pleroma do
diff --git a/lib/pleroma/config/transfer_task.ex b/lib/pleroma/config/transfer_task.ex
index 1846aa22c..435fc7450 100644
--- a/lib/pleroma/config/transfer_task.ex
+++ b/lib/pleroma/config/transfer_task.ex
@@ -42,7 +42,8 @@ defmodule Pleroma.Config.TransferTask do
@spec load_and_update_env([ConfigDB.t()]) :: :ok | false
def load_and_update_env(deleted \\ [], restart_pleroma? \\ true) do
- with true <- Pleroma.Config.get(:configurable_from_database),
+ with {:configurable, true} <-
+ {:configurable, Pleroma.Config.get(:configurable_from_database)},
true <- Ecto.Adapters.SQL.table_exists?(Repo, "config"),
started_applications <- Application.started_applications() do
# We need to restart applications for loaded settings take effect
@@ -65,12 +66,15 @@ defmodule Pleroma.Config.TransferTask do
if :pleroma in applications do
List.delete(applications, :pleroma) ++ [:pleroma]
else
+ Restarter.Pleroma.rebooted()
applications
end
Enum.each(applications, &restart(started_applications, &1, Pleroma.Config.get(:env)))
:ok
+ else
+ {:configurable, false} -> Restarter.Pleroma.rebooted()
end
end
diff --git a/lib/pleroma/moderation_log.ex b/lib/pleroma/moderation_log.ex
index c81477f48..e32895f70 100644
--- a/lib/pleroma/moderation_log.ex
+++ b/lib/pleroma/moderation_log.ex
@@ -392,24 +392,6 @@ defmodule Pleroma.ModerationLog do
data: %{
"actor" => %{"nickname" => actor_nickname},
"action" => "activate",
- "subject" => user
- }
- })
- when is_map(user) do
- get_log_entry_message(%ModerationLog{
- data: %{
- "actor" => %{"nickname" => actor_nickname},
- "action" => "activate",
- "subject" => [user]
- }
- })
- end
-
- @spec get_log_entry_message(ModerationLog) :: String.t()
- def get_log_entry_message(%ModerationLog{
- data: %{
- "actor" => %{"nickname" => actor_nickname},
- "action" => "activate",
"subject" => users
}
}) do
@@ -421,24 +403,6 @@ defmodule Pleroma.ModerationLog do
data: %{
"actor" => %{"nickname" => actor_nickname},
"action" => "deactivate",
- "subject" => user
- }
- })
- when is_map(user) do
- get_log_entry_message(%ModerationLog{
- data: %{
- "actor" => %{"nickname" => actor_nickname},
- "action" => "deactivate",
- "subject" => [user]
- }
- })
- end
-
- @spec get_log_entry_message(ModerationLog) :: String.t()
- def get_log_entry_message(%ModerationLog{
- data: %{
- "actor" => %{"nickname" => actor_nickname},
- "action" => "deactivate",
"subject" => users
}
}) do
@@ -478,26 +442,6 @@ defmodule Pleroma.ModerationLog do
data: %{
"actor" => %{"nickname" => actor_nickname},
"action" => "grant",
- "subject" => user,
- "permission" => permission
- }
- })
- when is_map(user) do
- get_log_entry_message(%ModerationLog{
- data: %{
- "actor" => %{"nickname" => actor_nickname},
- "action" => "grant",
- "subject" => [user],
- "permission" => permission
- }
- })
- end
-
- @spec get_log_entry_message(ModerationLog) :: String.t()
- def get_log_entry_message(%ModerationLog{
- data: %{
- "actor" => %{"nickname" => actor_nickname},
- "action" => "grant",
"subject" => users,
"permission" => permission
}
@@ -510,26 +454,6 @@ defmodule Pleroma.ModerationLog do
data: %{
"actor" => %{"nickname" => actor_nickname},
"action" => "revoke",
- "subject" => user,
- "permission" => permission
- }
- })
- when is_map(user) do
- get_log_entry_message(%ModerationLog{
- data: %{
- "actor" => %{"nickname" => actor_nickname},
- "action" => "revoke",
- "subject" => [user],
- "permission" => permission
- }
- })
- end
-
- @spec get_log_entry_message(ModerationLog) :: String.t()
- def get_log_entry_message(%ModerationLog{
- data: %{
- "actor" => %{"nickname" => actor_nickname},
- "action" => "revoke",
"subject" => users,
"permission" => permission
}
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 8746273c4..348fdedf1 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -591,7 +591,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
limit = Pleroma.Config.get([:instance, :limit])
length = String.length(full_payload)
- if length < limit do
+ if length <= limit do
:ok
else
{:error, dgettext("errors", "The status is over the character limit")}