Merge branch 'refactor/following-relationships' into 'develop'
[akkoma] / lib / pleroma / user.ex
index 03c02a47f3402662633e52b2b0a2c322a164f970..40171620ed3901ab60857b17e9490772dc627ac5 100644 (file)
@@ -218,54 +218,6 @@ defmodule Pleroma.User do
 
   defdelegate following_count(user), to: FollowingRelationship
 
-  @info_fields [
-    :banner,
-    :background,
-    :source_data,
-    :note_count,
-    :follower_count,
-    :following_count,
-    :locked,
-    :confirmation_pending,
-    :password_reset_pending,
-    :confirmation_token,
-    :default_scope,
-    :blocks,
-    :domain_blocks,
-    :mutes,
-    :muted_reblogs,
-    :muted_notifications,
-    :subscribers,
-    :deactivated,
-    :no_rich_text,
-    :ap_enabled,
-    :is_moderator,
-    :is_admin,
-    :show_role,
-    :settings,
-    :magic_key,
-    :uri,
-    :hide_followers_count,
-    :hide_follows_count,
-    :hide_followers,
-    :hide_follows,
-    :hide_favorites,
-    :unread_conversation_count,
-    :pinned_activities,
-    :email_notifications,
-    :mascot,
-    :emoji,
-    :pleroma_settings_store,
-    :fields,
-    :raw_fields,
-    :discoverable,
-    :invisible,
-    :skip_thread_containment,
-    :notification_settings
-  ]
-
-  def info_fields, do: @info_fields
-
   defp truncate_fields_param(params) do
     if Map.has_key?(params, :fields) do
       Map.put(params, :fields, Enum.map(params[:fields], &truncate_field/1))
@@ -968,7 +920,7 @@ defmodule Pleroma.User do
     end
   end
 
-  def set_unread_conversation_count(_), do: :noop
+  def set_unread_conversation_count(user), do: {:ok, user}
 
   def increment_unread_conversation_count(conversation, %User{local: true} = user) do
     unread_query =
@@ -990,7 +942,7 @@ defmodule Pleroma.User do
     end
   end
 
-  def increment_unread_conversation_count(_, _), do: :noop
+  def increment_unread_conversation_count(_, user), do: {:ok, user}
 
   @spec get_users_from_set([String.t()], boolean()) :: [User.t()]
   def get_users_from_set(ap_ids, local_only \\ true) do
@@ -1062,7 +1014,7 @@ defmodule Pleroma.User do
     if following?(blocked, blocker), do: unfollow(blocked, blocker)
 
     {:ok, blocker} = update_follower_count(blocker)
-
+    {:ok, blocker, _} = Participation.mark_all_as_read(blocker, blocked)
     add_to_block(blocker, ap_id)
   end