From: Ivan Tashkinov Date: Mon, 21 Oct 2019 08:05:09 +0000 (+0300) Subject: Merge remote-tracking branch 'remotes/upstream/develop' into 1304-user-info-deprecation X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=a11a7176d59deafa08a865d6e0950b9b9c540f18;p=akkoma Merge remote-tracking branch 'remotes/upstream/develop' into 1304-user-info-deprecation # Conflicts: # lib/pleroma/user/info.ex # lib/pleroma/web/activity_pub/activity_pub.ex # lib/pleroma/web/activity_pub/transmogrifier.ex --- a11a7176d59deafa08a865d6e0950b9b9c540f18 diff --cc lib/pleroma/user.ex index 89f88c74d,2bbfaa55b..00a1df133 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@@ -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 diff --cc lib/pleroma/web/activity_pub/activity_pub.ex index d4dac5dab,9a0a3522a..7fc5051ea --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@@ -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"], diff --cc lib/pleroma/web/activity_pub/transmogrifier.ex index c9560a15f,4a250d131..9b3ee842b --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@@ -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 @@@ -610,9 -617,8 +616,10 @@@ 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)