Fix ids, notifications for Husky

master
teknomunk 1 year ago
parent e6638cd2fb
commit 2d45847e41

@ -72,8 +72,7 @@ bool handle_notifications( struct http_request* req )
int note_count = fs_list_get("data/notices/HEAD");
for( int i = params.since_id; (i < params.limit) && (i < note_count); ++i ) {
int note_id = note_count - i;
for( int note_id = note_count; (notes.count < params.limit) && ( note_id > params.since_id ); note_id -= 1 ) {
struct notification* n = notification_from_id(note_id);
bool include = true;

@ -1 +1 @@
Subproject commit f035a0e7f9cc809016c268f49f9174611df3061e
Subproject commit 9b1a1397a4e030ae7b42d2c27445b36073f9225e

@ -182,14 +182,13 @@ void status_add_reply( struct status* s, struct status* child )
bool is_already_parent_reply = false;
for( int i = 0; i < s->replies.count; ++i ) {
if( s->replies.items[i] == child->id ) {
is_already_parent_reply = true;
return;
}
}
if( !is_already_parent_reply ) {
int id = child->id;
array_append( &s->replies, sizeof(id), &id );
status_save(s);
}
int id = child->id;
array_append( &s->replies, sizeof(id), &id );
status_save(s);
}
void status_add_mention( struct status* s, int id )
{
@ -231,7 +230,7 @@ bool status_sync_from_activity_pub( struct status* s, struct ap_object* act )
struct status* parent = status_from_uri_or_fetch( act->in_reply_to );
if( parent ) {
status_make_reply_to( s, parent->id );
status_save(parent);
// DO NOT SAVE parent! This is done inside status_make_reply_to
status_free(parent);
}
}

@ -98,7 +98,7 @@ bool int_to_string_callback( void* field_data, bool is_read, char** res )
if( is_read ) {
return 1 == sscanf( *res, "%d", field );
} else {
*res = aformat( "%d", *field );
*res = aformat( "%018d", *field );
return true;
}
}

@ -38,7 +38,7 @@ static bool write_in_reply_to( struct json_writer* jw, const char* field_name, v
json_write_indention(jw);
json_write_field_name(jw,"in_reply_to_id");
fprintf( jw->f, "\"%d\"", in_reply_to->id );
fprintf( jw->f, "\"%018d\"", in_reply_to->id );
} else {
json_write_field_name(jw,"in_reply_to_account_id");
fprintf( jw->f, "null" );

Loading…
Cancel
Save