Add "local" to users admin API

This commit is contained in:
Maxim Filippov 2019-03-13 16:04:44 +03:00
parent 92a0210fb0
commit 490d9cf7b1
2 changed files with 15 additions and 7 deletions

View File

@ -21,6 +21,7 @@ def render("show.json", %{user: user}) do
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"local" => user.local,
"roles" => Info.roles(user.info) "roles" => Info.roles(user.info)
} }
end end

View File

@ -394,7 +394,8 @@ test "regular search" do
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true
} }
] ]
} }
@ -418,7 +419,8 @@ test "regular search with page size" do
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true
} }
] ]
} }
@ -436,7 +438,8 @@ test "regular search with page size" do
"deactivated" => user2.info.deactivated, "deactivated" => user2.info.deactivated,
"id" => user2.id, "id" => user2.id,
"nickname" => user2.nickname, "nickname" => user2.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true
} }
] ]
} }
@ -461,7 +464,8 @@ test "only local users" do
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true
} }
] ]
} }
@ -486,13 +490,15 @@ test "only local users with no query" do
"deactivated" => admin.info.deactivated, "deactivated" => admin.info.deactivated,
"id" => admin.id, "id" => admin.id,
"nickname" => admin.nickname, "nickname" => admin.nickname,
"roles" => %{"admin" => true, "moderator" => false} "roles" => %{"admin" => true, "moderator" => false},
"local" => true
}, },
%{ %{
"deactivated" => user.info.deactivated, "deactivated" => user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true
} }
] ]
} }
@ -513,7 +519,8 @@ test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation" do
"deactivated" => !user.info.deactivated, "deactivated" => !user.info.deactivated,
"id" => user.id, "id" => user.id,
"nickname" => user.nickname, "nickname" => user.nickname,
"roles" => %{"admin" => false, "moderator" => false} "roles" => %{"admin" => false, "moderator" => false},
"local" => true
} }
end end
end end