Feature/1072 muting notifications

This commit is contained in:
Alexander Strizhakov 2019-07-14 13:29:31 +00:00 committed by kaniini
commit e7c39b7ac8
13 changed files with 390 additions and 64 deletions

View file

@ -0,0 +1,24 @@
defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do
use Ecto.Migration
alias Pleroma.User
def change do
query =
User.Query.build(%{
local: true,
active: true,
order_by: :id
})
Pleroma.Repo.stream(query)
|> Enum.each(fn
%{info: %{mutes: mutes} = info} = user ->
info_cng =
Ecto.Changeset.cast(info, %{muted_notifications: mutes}, [:muted_notifications])
Ecto.Changeset.change(user)
|> Ecto.Changeset.put_embed(:info, info_cng)
|> Pleroma.Repo.update()
end)
end
end