forked from AkkomaGang/akkoma
mastodon api: properly track if an account is locked or not
This commit is contained in:
parent
1f3eb0f470
commit
c0ca9f82b9
4 changed files with 7 additions and 4 deletions
|
@ -67,7 +67,8 @@ def user_info(%User{} = user) do
|
||||||
%{
|
%{
|
||||||
following_count: length(user.following) - oneself,
|
following_count: length(user.following) - oneself,
|
||||||
note_count: user.info["note_count"] || 0,
|
note_count: user.info["note_count"] || 0,
|
||||||
follower_count: user.info["follower_count"] || 0
|
follower_count: user.info["follower_count"] || 0,
|
||||||
|
locked: user.info["locked"] || false
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -464,6 +464,7 @@ def user_data_from_user_object(data) do
|
||||||
"url" => [%{"href" => data["image"]["url"]}]
|
"url" => [%{"href" => data["image"]["url"]}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
locked = data["manuallyApprovesFollowers"] || false
|
||||||
data = Transmogrifier.maybe_fix_user_object(data)
|
data = Transmogrifier.maybe_fix_user_object(data)
|
||||||
|
|
||||||
user_data = %{
|
user_data = %{
|
||||||
|
@ -471,7 +472,8 @@ def user_data_from_user_object(data) do
|
||||||
info: %{
|
info: %{
|
||||||
"ap_enabled" => true,
|
"ap_enabled" => true,
|
||||||
"source_data" => data,
|
"source_data" => data,
|
||||||
"banner" => banner
|
"banner" => banner,
|
||||||
|
"locked" => locked
|
||||||
},
|
},
|
||||||
avatar: avatar,
|
avatar: avatar,
|
||||||
nickname: "#{data["preferredUsername"]}@#{URI.parse(data["id"]).host}",
|
nickname: "#{data["preferredUsername"]}@#{URI.parse(data["id"]).host}",
|
||||||
|
|
|
@ -26,7 +26,7 @@ def render("user.json", %{user: user}) do
|
||||||
"name" => user.name,
|
"name" => user.name,
|
||||||
"summary" => user.bio,
|
"summary" => user.bio,
|
||||||
"url" => user.ap_id,
|
"url" => user.ap_id,
|
||||||
"manuallyApprovesFollowers" => false,
|
"manuallyApprovesFollowers" => user.info["locked"] || false,
|
||||||
"publicKey" => %{
|
"publicKey" => %{
|
||||||
"id" => "#{user.ap_id}#main-key",
|
"id" => "#{user.ap_id}#main-key",
|
||||||
"owner" => user.ap_id,
|
"owner" => user.ap_id,
|
||||||
|
|
|
@ -19,7 +19,7 @@ def render("account.json", %{user: user}) do
|
||||||
username: hd(String.split(user.nickname, "@")),
|
username: hd(String.split(user.nickname, "@")),
|
||||||
acct: user.nickname,
|
acct: user.nickname,
|
||||||
display_name: user.name || user.nickname,
|
display_name: user.name || user.nickname,
|
||||||
locked: false,
|
locked: user_info.locked,
|
||||||
created_at: Utils.to_masto_date(user.inserted_at),
|
created_at: Utils.to_masto_date(user.inserted_at),
|
||||||
followers_count: user_info.follower_count,
|
followers_count: user_info.follower_count,
|
||||||
following_count: user_info.following_count,
|
following_count: user_info.following_count,
|
||||||
|
|
Loading…
Reference in a new issue