Merge remote-tracking branch 'remotes/upstream/develop' into 1304-user-info-deprecation
authorIvan Tashkinov <ivantashkinov@gmail.com>
Mon, 21 Oct 2019 08:05:09 +0000 (11:05 +0300)
committerIvan Tashkinov <ivantashkinov@gmail.com>
Mon, 21 Oct 2019 08:05:09 +0000 (11:05 +0300)
# Conflicts:
# lib/pleroma/user/info.ex
# lib/pleroma/web/activity_pub/activity_pub.ex
# lib/pleroma/web/activity_pub/transmogrifier.ex

1  2 
lib/pleroma/user.ex
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/transmogrifier.ex
lib/pleroma/web/activity_pub/views/user_view.ex
test/user_test.exs
test/web/activity_pub/activity_pub_test.exs
test/web/activity_pub/views/user_view_test.exs
test/web/mastodon_api/controllers/status_controller_test.exs

index 89f88c74d6f41287b6bc5801d7f184e235071643,2bbfaa55b030e977b577b5052b774c94ee46f729..00a1df133d57f7b6216d3c9bf384dbde16dda24b
@@@ -138,10 -84,13 +138,13 @@@ defmodule Pleroma.User d
  
    def visible_for?(_, _), do: false
  
 -  def superuser?(%User{local: true, info: %User.Info{is_admin: true}}), do: true
 -  def superuser?(%User{local: true, info: %User.Info{is_moderator: true}}), do: true
 +  def superuser?(%User{local: true, is_admin: true}), do: true
 +  def superuser?(%User{local: true, is_moderator: true}), do: true
    def superuser?(_), do: false
  
+   def invisible?(%User{info: %User.Info{invisible: true}}), do: true
+   def invisible?(_), do: false
    def avatar_url(user, options \\ []) do
      case user.avatar do
        %{"url" => [%{"href" => href} | _]} -> href
index d4dac5dab3bf54cbe361a6f5dd685dac758cda65,9a0a3522af567cea6bef4059f15ee3ebd20287ed..7fc5051ea6307f308d053b4e2ac61a725614ae06
@@@ -1105,12 -1110,15 +1106,13 @@@ defmodule Pleroma.Web.ActivityPub.Activ
  
      user_data = %{
        ap_id: data["id"],
-       banner: banner,
-       discoverable: discoverable,
 -      info: %{
 -        ap_enabled: true,
 -        source_data: data,
 -        banner: banner,
 -        fields: fields,
 -        locked: locked,
 -        discoverable: discoverable,
 -        invisible: invisible
 -      },
++      ap_enabled: true,
 +      source_data: data,
++      banner: banner,
 +      fields: fields,
 +      locked: locked,
-       ap_enabled: true,
++      discoverable: discoverable,
++      invisible: invisible,
        avatar: avatar,
        name: data["name"],
        follower_address: data["followers"],
index c9560a15f744af4d3e58938e2bd406ad4c336706,4a250d131d6dcedbe40cb6705899aae49717055c..9b3ee842ba9886b9e92845b8d0b80356597c96a1
@@@ -600,8 -605,10 +605,9 @@@ defmodule Pleroma.Web.ActivityPub.Trans
      with %User{ap_id: ^actor_id} = actor <- User.get_cached_by_ap_id(object["id"]) do
        {:ok, new_user_data} = ActivityPub.user_data_from_user_object(object)
  
 -      banner = new_user_data[:info][:banner]
 -      locked = new_user_data[:info][:locked] || false
 -      attachment = get_in(new_user_data, [:info, :source_data, "attachment"]) || []
 -      invisible = new_user_data[:info][:invisible] || false
 +      locked = new_user_data[:locked] || false
 +      attachment = get_in(new_user_data, [:source_data, "attachment"]) || []
++      invisible = new_user_data[:invisible] || false
  
        fields =
          attachment
  
        update_data =
          new_user_data
 -        |> Map.take([:name, :bio, :avatar])
 -        |> Map.put(:info, %{banner: banner, locked: locked, fields: fields, invisible: invisible})
 +        |> Map.take([:avatar, :banner, :bio, :name])
 +        |> Map.put(:fields, fields)
 +        |> Map.put(:locked, locked)
++        |> Map.put(:invisible, invisible)
  
        actor
        |> User.upgrade_changeset(update_data, true)
Simple merge