[FIX] Do some cosmetic changes to the route(see #36)

This commit is contained in:
lda 2023-09-21 08:05:30 +02:00
parent 2d1c51beca
commit 15d0ffb0f4
Signed by: lda
GPG key ID: 6898757653ABE3E6

View file

@ -96,18 +96,12 @@ ROUTE_IMPL(RouteAdminDeactivate, path, argp)
if (method == HTTP_DELETE) if (method == HTTP_DELETE)
{ {
char * str;
UserDeactivateWithInfo(removed, UserGetName(user), reason); UserDeactivateWithInfo(removed, UserGetName(user), reason);
response = HashMapCreate(); response = HashMapCreate();
str = removedLocalpart; JsonSet(response, JsonValueString(removedLocalpart), 1, "user");
JsonSet(response, JsonValueString(str), 1, "user"); JsonSet(response, JsonValueString(reason), 1, "reason");
JsonSet(response, JsonValueString(UserGetName(user)), 1, "banned_by");
str = reason;
JsonSet(response, JsonValueString(str), 1, "reason");
str = UserGetName(user);
JsonSet(response, JsonValueString(str), 1, "banned_by");
} }
else else
{ {
@ -116,14 +110,8 @@ ROUTE_IMPL(RouteAdminDeactivate, path, argp)
} }
finish: finish:
if (user)
{
UserUnlock(user); UserUnlock(user);
}
if (removed)
{
UserUnlock(removed); UserUnlock(removed);
}
JsonFree(request); JsonFree(request);
return response; return response;
} }