Merge branch 'develop' into webhooks
This commit is contained in:
commit
133fc64472
432 changed files with 13238 additions and 3502 deletions
|
|
@ -23,10 +23,12 @@ defmodule Pleroma.Repo.Migrations.MoveActivityExpirationsToOban do
|
|||
|> Pleroma.Repo.stream()
|
||||
|> Stream.each(fn expiration ->
|
||||
with {:ok, expires_at} <- DateTime.from_naive(expiration.scheduled_at, "Etc/UTC") do
|
||||
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
|
||||
activity_id: FlakeId.to_string(expiration.activity_id),
|
||||
expires_at: expires_at
|
||||
})
|
||||
Pleroma.Workers.PurgeExpiredActivity.enqueue(
|
||||
%{
|
||||
activity_id: FlakeId.to_string(expiration.activity_id)
|
||||
},
|
||||
scheduled_at: expires_at
|
||||
)
|
||||
end
|
||||
end)
|
||||
|> Stream.run()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ defmodule Pleroma.Repo.Migrations.MoveTokensExpirationIntoOban do
|
|||
from(t in Pleroma.Web.OAuth.Token, where: t.valid_until > ^NaiveDateTime.utc_now())
|
||||
|> Pleroma.Repo.stream()
|
||||
|> Stream.each(fn token ->
|
||||
Pleroma.Workers.PurgeExpiredToken.enqueue(%{
|
||||
enqueue(%{
|
||||
token_id: token.id,
|
||||
valid_until: DateTime.from_naive!(token.valid_until, "Etc/UTC"),
|
||||
mod: Pleroma.Web.OAuth.Token
|
||||
|
|
@ -33,7 +33,7 @@ defmodule Pleroma.Repo.Migrations.MoveTokensExpirationIntoOban do
|
|||
from(t in Pleroma.MFA.Token, where: t.valid_until > ^NaiveDateTime.utc_now())
|
||||
|> Pleroma.Repo.stream()
|
||||
|> Stream.each(fn token ->
|
||||
Pleroma.Workers.PurgeExpiredToken.enqueue(%{
|
||||
enqueue(%{
|
||||
token_id: token.id,
|
||||
valid_until: DateTime.from_naive!(token.valid_until, "Etc/UTC"),
|
||||
mod: Pleroma.MFA.Token
|
||||
|
|
@ -41,4 +41,14 @@ defmodule Pleroma.Repo.Migrations.MoveTokensExpirationIntoOban do
|
|||
end)
|
||||
|> Stream.run()
|
||||
end
|
||||
|
||||
@spec enqueue(%{token_id: integer(), valid_until: DateTime.t()}) ::
|
||||
{:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}
|
||||
defp enqueue(args) do
|
||||
{scheduled_at, args} = Map.pop(args, :valid_until)
|
||||
|
||||
args
|
||||
|> Pleroma.Workers.PurgeExpiredToken.new(scheduled_at: scheduled_at)
|
||||
|> Oban.insert()
|
||||
end
|
||||
end
|
||||
|
|
|
|||
11
priv/repo/migrations/20220222203933_add_pinned_to_chats.exs
Normal file
11
priv/repo/migrations/20220222203933_add_pinned_to_chats.exs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddPinnedToChats do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:chats) do
|
||||
add(:pinned, :boolean, default: false, null: false)
|
||||
end
|
||||
|
||||
create(index(:chats, [:pinned]))
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddActivityAssignedAccountIndex do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create_if_not_exists(
|
||||
index(:activities, ["(data->>'assigned_account')"],
|
||||
name: :activities_assigned_account_index
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddAcceptsChatMessagesIndexToUsers do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create(index(:users, [:accepts_chat_messages]))
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddExclusiveToLists do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:lists) do
|
||||
add(:exclusive, :boolean, default: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Pleroma.Repo.Migrations.CleanupStaleDigestEmailJobs do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
execute(
|
||||
"DELETE from oban_jobs WHERE queue = 'mailer' AND worker = 'Pleroma.Workers.Cron.DigestEmailsWorker'"
|
||||
)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue