Merge branch 'feature/notification-control-part-2' into 'develop'
notification controls, part 2 See merge request pleroma/pleroma!1204
This commit is contained in:
commit
5402d04e3c
8 changed files with 84 additions and 42 deletions
|
|
@ -46,7 +46,12 @@ defmodule Pleroma.User.Info do
|
|||
field(:emoji, {:array, :map}, default: [])
|
||||
|
||||
field(:notification_settings, :map,
|
||||
default: %{"remote" => true, "local" => true, "followers" => true, "follows" => true}
|
||||
default: %{
|
||||
"followers" => true,
|
||||
"follows" => true,
|
||||
"non_follows" => true,
|
||||
"non_followers" => true
|
||||
}
|
||||
)
|
||||
|
||||
# Found in the wild
|
||||
|
|
@ -67,10 +72,15 @@ defmodule Pleroma.User.Info do
|
|||
end
|
||||
|
||||
def update_notification_settings(info, settings) do
|
||||
settings =
|
||||
settings
|
||||
|> Enum.map(fn {k, v} -> {k, v in [true, "true", "True", "1"]} end)
|
||||
|> Map.new()
|
||||
|
||||
notification_settings =
|
||||
info.notification_settings
|
||||
|> Map.merge(settings)
|
||||
|> Map.take(["remote", "local", "followers", "follows"])
|
||||
|> Map.take(["followers", "follows", "non_follows", "non_followers"])
|
||||
|
||||
params = %{notification_settings: notification_settings}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue