aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/notification.ex29
-rw-r--r--lib/pleroma/user/notification_setting.ex14
-rw-r--r--lib/pleroma/web/api_spec/schemas/account.ex14
3 files changed, 21 insertions, 36 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index 9ee9606be..9d09cf082 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -550,10 +550,9 @@ defmodule Pleroma.Notification do
[
:self,
:invisible,
- :followers,
- :follows,
- :non_followers,
- :non_follows,
+ :from_followers,
+ :from_following,
+ :from_strangers,
:recently_followed
]
|> Enum.find(&skip?(&1, activity, user))
@@ -573,9 +572,9 @@ defmodule Pleroma.Notification do
end
def skip?(
- :followers,
+ :from_followers,
%Activity{} = activity,
- %User{notification_settings: %{followers: false}} = user
+ %User{notification_settings: %{from_followers: false}} = user
) do
actor = activity.data["actor"]
follower = User.get_cached_by_ap_id(actor)
@@ -583,9 +582,9 @@ defmodule Pleroma.Notification do
end
def skip?(
- :non_followers,
+ :from_strangers,
%Activity{} = activity,
- %User{notification_settings: %{non_followers: false}} = user
+ %User{notification_settings: %{from_strangers: false}} = user
) do
actor = activity.data["actor"]
follower = User.get_cached_by_ap_id(actor)
@@ -593,25 +592,15 @@ defmodule Pleroma.Notification do
end
def skip?(
- :follows,
+ :from_following,
%Activity{} = activity,
- %User{notification_settings: %{follows: false}} = user
+ %User{notification_settings: %{from_following: false}} = user
) do
actor = activity.data["actor"]
followed = User.get_cached_by_ap_id(actor)
User.following?(user, followed)
end
- def skip?(
- :non_follows,
- %Activity{} = activity,
- %User{notification_settings: %{non_follows: false}} = user
- ) do
- actor = activity.data["actor"]
- followed = User.get_cached_by_ap_id(actor)
- !User.following?(user, followed)
- end
-
# To do: consider defining recency in hours and checking FollowingRelationship with a single SQL
def skip?(:recently_followed, %Activity{data: %{"type" => "Follow"}} = activity, %User{} = user) do
actor = activity.data["actor"]
diff --git a/lib/pleroma/user/notification_setting.ex b/lib/pleroma/user/notification_setting.ex
index 4bd55e139..e47ac4cab 100644
--- a/lib/pleroma/user/notification_setting.ex
+++ b/lib/pleroma/user/notification_setting.ex
@@ -10,20 +10,18 @@ defmodule Pleroma.User.NotificationSetting do
@primary_key false
embedded_schema do
- field(:followers, :boolean, default: true)
- field(:follows, :boolean, default: true)
- field(:non_follows, :boolean, default: true)
- field(:non_followers, :boolean, default: true)
+ field(:from_followers, :boolean, default: true)
+ field(:from_following, :boolean, default: true)
+ field(:from_strangers, :boolean, default: true)
field(:privacy_option, :boolean, default: false)
end
def changeset(schema, params) do
schema
|> cast(prepare_attrs(params), [
- :followers,
- :follows,
- :non_follows,
- :non_followers,
+ :from_followers,
+ :from_following,
+ :from_strangers,
:privacy_option
])
end
diff --git a/lib/pleroma/web/api_spec/schemas/account.ex b/lib/pleroma/web/api_spec/schemas/account.ex
index d54e2158d..ed90ef3db 100644
--- a/lib/pleroma/web/api_spec/schemas/account.ex
+++ b/lib/pleroma/web/api_spec/schemas/account.ex
@@ -57,10 +57,9 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
notification_settings: %Schema{
type: :object,
properties: %{
- followers: %Schema{type: :boolean},
- follows: %Schema{type: :boolean},
- non_followers: %Schema{type: :boolean},
- non_follows: %Schema{type: :boolean},
+ from_followers: %Schema{type: :boolean},
+ from_following: %Schema{type: :boolean},
+ from_strangers: %Schema{type: :boolean},
privacy_option: %Schema{type: :boolean}
}
},
@@ -123,10 +122,9 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
"unread_conversation_count" => 0,
"tags" => [],
"notification_settings" => %{
- "followers" => true,
- "follows" => true,
- "non_followers" => true,
- "non_follows" => true,
+ "from_followers" => true,
+ "from_following" => true,
+ "from_strangers" => true,
"privacy_option" => false
},
"relationship" => %{