forked from AkkomaGang/akkoma
Use atoms when updating user info
This commit is contained in:
parent
e5b850a991
commit
d06d1b751d
2 changed files with 11 additions and 11 deletions
|
@ -986,10 +986,10 @@ defp object_to_user_data(data) do
|
||||||
user_data = %{
|
user_data = %{
|
||||||
ap_id: data["id"],
|
ap_id: data["id"],
|
||||||
info: %{
|
info: %{
|
||||||
"ap_enabled" => true,
|
ap_enabled: true,
|
||||||
"source_data" => data,
|
source_data: data,
|
||||||
"banner" => banner,
|
banner: banner,
|
||||||
"locked" => locked
|
locked: locked
|
||||||
},
|
},
|
||||||
avatar: avatar,
|
avatar: avatar,
|
||||||
name: data["name"],
|
name: data["name"],
|
||||||
|
@ -1023,10 +1023,10 @@ def fetch_follow_information_for_user(user) do
|
||||||
followers_count when is_integer(followers_count) <- followers_data["totalItems"],
|
followers_count when is_integer(followers_count) <- followers_data["totalItems"],
|
||||||
{:ok, hide_followers} <- collection_private(followers_data) do
|
{:ok, hide_followers} <- collection_private(followers_data) do
|
||||||
info = %{
|
info = %{
|
||||||
"hide_follows" => hide_follows,
|
hide_follows: hide_follows,
|
||||||
"follower_count" => followers_count,
|
follower_count: followers_count,
|
||||||
"following_count" => following_count,
|
following_count: following_count,
|
||||||
"hide_followers" => hide_followers
|
hide_followers: hide_followers
|
||||||
}
|
}
|
||||||
|
|
||||||
info = Map.merge(user.info, info)
|
info = Map.merge(user.info, info)
|
||||||
|
|
|
@ -609,13 +609,13 @@ def handle_incoming(
|
||||||
with %User{ap_id: ^actor_id} = actor <- User.get_cached_by_ap_id(object["id"]) 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)
|
{:ok, new_user_data} = ActivityPub.user_data_from_user_object(object)
|
||||||
|
|
||||||
banner = new_user_data[:info]["banner"]
|
banner = new_user_data[:info][:banner]
|
||||||
locked = new_user_data[:info]["locked"] || false
|
locked = new_user_data[:info][:locked] || false
|
||||||
|
|
||||||
update_data =
|
update_data =
|
||||||
new_user_data
|
new_user_data
|
||||||
|> Map.take([:name, :bio, :avatar])
|
|> Map.take([:name, :bio, :avatar])
|
||||||
|> Map.put(:info, %{"banner" => banner, "locked" => locked})
|
|> Map.put(:info, %{banner: banner, locked: locked})
|
||||||
|
|
||||||
actor
|
actor
|
||||||
|> User.upgrade_changeset(update_data)
|
|> User.upgrade_changeset(update_data)
|
||||||
|
|
Loading…
Reference in a new issue