Merge branch 'develop' into refactor/following-relationships
authorEgor Kislitsyn <egor@kislitsyn.com>
Mon, 21 Oct 2019 07:19:15 +0000 (14:19 +0700)
committerEgor Kislitsyn <egor@kislitsyn.com>
Mon, 21 Oct 2019 07:19:15 +0000 (14:19 +0700)
1  2 
lib/mix/tasks/pleroma/database.ex
lib/pleroma/user.ex
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
test/support/factory.ex
test/user_test.exs
test/web/activity_pub/activity_pub_test.exs
test/web/activity_pub/relay_test.exs
test/web/activity_pub/transmogrifier_test.exs
test/web/mastodon_api/controllers/account_controller_test.exs

Simple merge
index c32f6b429c9a1f6c5e61dd454df7b35f5fc1d090,ec705b8f6ca4c5702b1461f01a2fd0f7fd6639cd..d3c767f334badbd71fbc778b419a7003003790d2
@@@ -418,11 -435,14 +416,7 @@@ defmodule Pleroma.User d
          {:error, "Could not follow user: #{followed.nickname} blocked you."}
  
        true ->
-         if !followed.local && follower.local && !ap_enabled?(followed) do
-           Websub.subscribe(follower, followed)
-         end
 -        q =
 -          from(u in User,
 -            where: u.id == ^follower.id,
 -            update: [push: [following: ^ap_followers]],
 -            select: u
 -          )
--
 -        {1, [follower]} = Repo.update_all(q, [])
 +        FollowingRelationship.follow(follower, followed, state)
  
          follower = maybe_update_following_count(follower)
  
index 54ba49520c503120ada9b0f286a54274aac61cb4,2c1ce9c550fbd8983a3f253423434d1b8636dc87..4eb718294c0d41bfb5e4127684ddfa92546eb22d
@@@ -555,8 -551,11 +556,9 @@@ defmodule Pleroma.Web.ActivityPub.Trans
               type: "Reject",
               actor: followed,
               object: follow_activity.data["id"],
-              local: false
+              local: false,
+              activity_id: id
             }) do
 -      User.unfollow(follower, followed)
 -
        {:ok, activity}
      else
        _e -> :error
    def perform(:user_upgrade, user) do
      # we pass a fake user so that the followers collection is stripped away
      old_follower_address = User.ap_followers(%User{nickname: user.nickname})
-     maybe_retire_websub(user.ap_id)
  
 -    q =
 -      from(
 -        u in User,
 -        where: ^old_follower_address in u.following,
 -        update: [
 -          set: [
 -            following:
 -              fragment(
 -                "array_replace(?,?,?)",
 -                u.following,
 -                ^old_follower_address,
 -                ^user.follower_address
 -              )
 -          ]
 +    from(
 +      a in Activity,
 +      where: ^old_follower_address in a.recipients,
 +      update: [
 +        set: [
 +          recipients:
 +            fragment(
 +              "array_replace(?,?,?)",
 +              a.recipients,
 +              ^old_follower_address,
 +              ^user.follower_address
 +            )
          ]
 -      )
 -
 -    Repo.update_all(q, [])
 -
 -    q =
 -      from(
 -        a in Activity,
 -        where: ^old_follower_address in a.recipients,
 -        update: [
 -          set: [
 -            recipients:
 -              fragment(
 -                "array_replace(?,?,?)",
 -                a.recipients,
 -                ^old_follower_address,
 -                ^user.follower_address
 -              )
 -          ]
 -        ]
 -      )
 -
 -    Repo.update_all(q, [])
 +      ]
 +    )
 +    |> Repo.update_all([])
    end
  
    def upgrade_user_from_ap_id(ap_id) do
Simple merge
Simple merge
Simple merge