Merge remote-tracking branch 'upstream/develop' into block-behavior
authorAlex Gleason <alex@alexgleason.me>
Thu, 29 Apr 2021 16:14:32 +0000 (11:14 -0500)
committerAlex Gleason <alex@alexgleason.me>
Thu, 29 Apr 2021 16:14:32 +0000 (11:14 -0500)
1  2 
CHANGELOG.md
config/config.exs
config/description.exs
docs/configuration/cheatsheet.md
lib/pleroma/notification.ex
lib/pleroma/web/activity_pub/activity_pub.ex
test/pleroma/web/activity_pub/activity_pub_test.exs
test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs
test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs

diff --cc CHANGELOG.md
Simple merge
Simple merge
Simple merge
Simple merge
index e9c9b3ea285cf1100a24ae7a071ae4504a0999b4,7efbdc49afe1811a145a78cc548ad0dd54935849..4cc9a5669ae8152dee183bfd804fa8863df93bbc
@@@ -129,10 -122,11 +122,12 @@@ defmodule Pleroma.Notification d
            a.data
          )
      )
+     |> join(:inner, [_n, a], u in User, on: u.ap_id == a.actor, as: :user_actor)
      |> preload([n, a, o], activity: {a, object: o})
+     |> where([user_actor: user_actor], user_actor.is_active)
      |> exclude_notification_muted(user, exclude_notification_muted_opts)
      |> exclude_blocked(user, exclude_blocked_opts)
 +    |> exclude_blockers(user)
      |> exclude_filtered(user)
      |> exclude_visibility(opts)
    end
index 0923e19e48c2488d281d80097c2a8bd4c6b7a130,d0051d1cb249319bfccfd943aed2087414b2194d..a35ba1fad31d3f4c95bfa4807319412110b478ab
@@@ -1137,50 -1270,51 +1309,52 @@@ defmodule Pleroma.Web.ActivityPub.Activ
        skip_thread_containment: Config.get([:instance, :skip_thread_containment])
      }
  
-     Activity
-     |> maybe_preload_objects(opts)
-     |> maybe_preload_bookmarks(opts)
-     |> maybe_preload_report_notes(opts)
-     |> maybe_set_thread_muted_field(opts)
-     |> maybe_order(opts)
-     |> restrict_recipients(recipients, opts[:user])
-     |> restrict_replies(opts)
-     |> restrict_tag(opts)
-     |> restrict_tag_reject(opts)
-     |> restrict_tag_all(opts)
-     |> restrict_since(opts)
-     |> restrict_local(opts)
-     |> restrict_actor(opts)
-     |> restrict_type(opts)
-     |> restrict_state(opts)
-     |> restrict_favorited_by(opts)
-     |> restrict_blocked(restrict_blocked_opts)
-     |> restrict_blockers_visibility(opts)
-     |> restrict_muted(restrict_muted_opts)
-     |> restrict_filtered(opts)
-     |> restrict_media(opts)
-     |> restrict_visibility(opts)
-     |> restrict_thread_visibility(opts, config)
-     |> restrict_reblogs(opts)
-     |> restrict_pinned(opts)
-     |> restrict_muted_reblogs(restrict_muted_reblogs_opts)
-     |> restrict_instance(opts)
-     |> restrict_announce_object_actor(opts)
-     |> restrict_filtered(opts)
-     |> Activity.restrict_deactivated_users()
-     |> exclude_poll_votes(opts)
-     |> exclude_chat_messages(opts)
-     |> exclude_invisible_actors(opts)
-     |> exclude_visibility(opts)
-   end
-   def fetch_activities(recipients, opts \\ %{}, pagination \\ :keyset) do
-     list_memberships = Pleroma.List.memberships(opts[:user])
-     fetch_activities_query(recipients ++ list_memberships, opts)
-     |> Pagination.fetch_paginated(opts, pagination)
-     |> Enum.reverse()
-     |> maybe_update_cc(list_memberships, opts[:user])
+     query =
+       Activity
+       |> maybe_preload_objects(opts)
+       |> maybe_preload_bookmarks(opts)
+       |> maybe_preload_report_notes(opts)
+       |> maybe_set_thread_muted_field(opts)
+       |> maybe_order(opts)
+       |> restrict_recipients(recipients, opts[:user])
+       |> restrict_replies(opts)
+       |> restrict_since(opts)
+       |> restrict_local(opts)
+       |> restrict_remote(opts)
+       |> restrict_actor(opts)
+       |> restrict_type(opts)
+       |> restrict_state(opts)
+       |> restrict_favorited_by(opts)
+       |> restrict_blocked(restrict_blocked_opts)
++      |> restrict_blockers_visibility(opts)
+       |> restrict_muted(restrict_muted_opts)
+       |> restrict_filtered(opts)
+       |> restrict_media(opts)
+       |> restrict_visibility(opts)
+       |> restrict_thread_visibility(opts, config)
+       |> restrict_reblogs(opts)
+       |> restrict_pinned(opts)
+       |> restrict_muted_reblogs(restrict_muted_reblogs_opts)
+       |> restrict_instance(opts)
+       |> restrict_announce_object_actor(opts)
+       |> restrict_filtered(opts)
+       |> Activity.restrict_deactivated_users()
+       |> exclude_poll_votes(opts)
+       |> exclude_chat_messages(opts)
+       |> exclude_invisible_actors(opts)
+       |> exclude_visibility(opts)
+     if Config.feature_enabled?(:improved_hashtag_timeline) do
+       query
+       |> restrict_hashtag_any(opts)
+       |> restrict_hashtag_all(opts)
+       |> restrict_hashtag_reject_any(opts)
+     else
+       query
+       |> restrict_embedded_tag_any(opts)
+       |> restrict_embedded_tag_all(opts)
+       |> restrict_embedded_tag_reject_any(opts)
+     end
    end
  
    @doc """