Use atoms when updating user info
authorrinpatch <rinpatch@sdf.org>
Sat, 13 Jul 2019 21:21:35 +0000 (00:21 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 13 Jul 2019 21:21:35 +0000 (00:21 +0300)
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/transmogrifier.ex

index eadd335cab155e4e4653d488c5ab016a011813b7..df4155d211f00d45931411d84a87843e9528084a 100644 (file)
@@ -986,10 +986,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
     user_data = %{
       ap_id: data["id"],
       info: %{
-        "ap_enabled" => true,
-        "source_data" => data,
-        "banner" => banner,
-        "locked" => locked
+        ap_enabled: true,
+        source_data: data,
+        banner: banner,
+        locked: locked
       },
       avatar: avatar,
       name: data["name"],
@@ -1023,10 +1023,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
          followers_count when is_integer(followers_count) <- followers_data["totalItems"],
          {:ok, hide_followers} <- collection_private(followers_data) do
       info = %{
-        "hide_follows" => hide_follows,
-        "follower_count" => followers_count,
-        "following_count" => following_count,
-        "hide_followers" => hide_followers
+        hide_follows: hide_follows,
+        follower_count: followers_count,
+        following_count: following_count,
+        hide_followers: hide_followers
       }
 
       info = Map.merge(user.info, info)
index e34fe661100923c5a5f786078a1d194d76286bfe..10b362908ff6a8e09163c65fa758383af06081f6 100644 (file)
@@ -609,13 +609,13 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
     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
+      banner = new_user_data[:info][:banner]
+      locked = new_user_data[:info][:locked] || false
 
       update_data =
         new_user_data
         |> Map.take([:name, :bio, :avatar])
-        |> Map.put(:info, %{"banner" => banner, "locked" => locked})
+        |> Map.put(:info, %{banner: banner, locked: locked})
 
       actor
       |> User.upgrade_changeset(update_data)