Slon/Api/V1/Statuses: Don't require authorization for 'context' endpoint
This commit is contained in:
parent
c5378f5cfd
commit
0d88ccf0c4
1 changed files with 22 additions and 22 deletions
|
@ -213,31 +213,31 @@ U0 @slon_api_v1_statuses_get(SlonHttpSession* session)
|
||||||
JsonItem* poll_choice = NULL;
|
JsonItem* poll_choice = NULL;
|
||||||
JsonArray* own_votes = NULL;
|
JsonArray* own_votes = NULL;
|
||||||
|
|
||||||
|
if (session->path_count() > 4 && !StrICmp("context", session->path(4))) {
|
||||||
|
JsonObject* context = Json.CreateObject(slon_mem_task);
|
||||||
|
context->set("ancestors", Json.CreateArray(slon_mem_task), JSON_ARRAY);
|
||||||
|
|
||||||
|
// Get ancestors
|
||||||
|
id = session->path(3);
|
||||||
|
status = @slon_api_find_status_by_id(id, NULL);
|
||||||
|
while (status && status->@("in_reply_to_id")) {
|
||||||
|
status = @slon_api_find_status_by_id(status->@("in_reply_to_id"), status->@("in_reply_to_acct_id"));
|
||||||
|
if (status) {
|
||||||
|
context->a("ancestors")->append(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get descendants
|
||||||
|
id = session->path(3);
|
||||||
|
context->set("descendants", @slon_api_v1_statuses_find_descendants_by_id(id), JSON_ARRAY);
|
||||||
|
|
||||||
|
session->send(context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (@slon_api_authorized(session)) {
|
if (@slon_api_authorized(session)) {
|
||||||
SLON_AUTH_ACCOUNT_ID
|
SLON_AUTH_ACCOUNT_ID
|
||||||
|
|
||||||
if (session->path_count() > 4 && !StrICmp("context", session->path(4))) {
|
|
||||||
JsonObject* context = Json.CreateObject(slon_mem_task);
|
|
||||||
context->set("ancestors", Json.CreateArray(slon_mem_task), JSON_ARRAY);
|
|
||||||
|
|
||||||
// Get ancestors
|
|
||||||
id = session->path(3);
|
|
||||||
status = @slon_api_find_status_by_id(id, NULL);
|
|
||||||
while (status && status->@("in_reply_to_id")) {
|
|
||||||
status = @slon_api_find_status_by_id(status->@("in_reply_to_id"), status->@("in_reply_to_acct_id"));
|
|
||||||
if (status) {
|
|
||||||
context->a("ancestors")->append(status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get descendants
|
|
||||||
id = session->path(3);
|
|
||||||
context->set("descendants", @slon_api_v1_statuses_find_descendants_by_id(id), JSON_ARRAY);
|
|
||||||
|
|
||||||
session->send(context);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = @slon_api_find_status_by_id(id, NULL);
|
status = @slon_api_find_status_by_id(id, NULL);
|
||||||
if (status) {
|
if (status) {
|
||||||
status = Json.Clone(status, session->mem_task);
|
status = Json.Clone(status, session->mem_task);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue