aboutsummaryrefslogtreecommitdiff
path: root/lib/mix/tasks
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2020-07-15 15:22:39 +0000
committerfeld <feld@feld.me>2020-07-15 15:22:39 +0000
commit00f9b53f07346d052adab105bde3428c98fc4660 (patch)
tree67e501144cffd4c3e70f8dc094793c6b2d2fb7b5 /lib/mix/tasks
parent0fe36b311c010f9a4bd3c1600ce874c5403a7368 (diff)
parent34d1d3e93e8642f2b784b5b957551af068c0f7ba (diff)
downloadpleroma-00f9b53f07346d052adab105bde3428c98fc4660.tar.gz
Merge branch 'refactor/notification_settings' into 'develop'
Refactor notification settings See merge request pleroma/pleroma!2602
Diffstat (limited to 'lib/mix/tasks')
-rw-r--r--lib/mix/tasks/pleroma/notification_settings.ex18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/mix/tasks/pleroma/notification_settings.ex b/lib/mix/tasks/pleroma/notification_settings.ex
index 7d65f0587..00f5ba7bf 100644
--- a/lib/mix/tasks/pleroma/notification_settings.ex
+++ b/lib/mix/tasks/pleroma/notification_settings.ex
@@ -3,8 +3,8 @@ defmodule Mix.Tasks.Pleroma.NotificationSettings do
@moduledoc """
Example:
- > mix pleroma.notification_settings --privacy-option=false --nickname-users="parallel588" # set false only for parallel588 user
- > mix pleroma.notification_settings --privacy-option=true # set true for all users
+ > mix pleroma.notification_settings --hide-notification-contents=false --nickname-users="parallel588" # set false only for parallel588 user
+ > mix pleroma.notification_settings --hide-notification-contents=true # set true for all users
"""
@@ -19,16 +19,16 @@ defmodule Mix.Tasks.Pleroma.NotificationSettings do
OptionParser.parse(
args,
strict: [
- privacy_option: :boolean,
+ hide_notification_contents: :boolean,
email_users: :string,
nickname_users: :string
]
)
- privacy_option = Keyword.get(options, :privacy_option)
+ hide_notification_contents = Keyword.get(options, :hide_notification_contents)
- if not is_nil(privacy_option) do
- privacy_option
+ if not is_nil(hide_notification_contents) do
+ hide_notification_contents
|> build_query(options)
|> Pleroma.Repo.update_all([])
end
@@ -36,15 +36,15 @@ defmodule Mix.Tasks.Pleroma.NotificationSettings do
shell_info("Done")
end
- defp build_query(privacy_option, options) do
+ defp build_query(hide_notification_contents, options) do
query =
from(u in Pleroma.User,
update: [
set: [
notification_settings:
fragment(
- "jsonb_set(notification_settings, '{privacy_option}', ?)",
- ^privacy_option
+ "jsonb_set(notification_settings, '{hide_notification_contents}', ?)",
+ ^hide_notification_contents
)
]
]