|
|
|
@ -98,8 +98,9 @@ bool status_sync_from_activity_pub( struct status* s, struct ap_activity* act )
|
|
|
|
|
s->account_id = a->id;
|
|
|
|
|
s->published = act->published;
|
|
|
|
|
s->remote = true;
|
|
|
|
|
s->stub = false;
|
|
|
|
|
|
|
|
|
|
s->source = strdup(act->source.content);
|
|
|
|
|
s->source = safe_strdup(act->source.content);
|
|
|
|
|
s->url = strdup( act->id );
|
|
|
|
|
|
|
|
|
|
// Erase existing media
|
|
|
|
@ -249,6 +250,23 @@ struct status* status_new_system_block( int account_id )
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
struct status* status_new_system_stub( struct status* stub )
|
|
|
|
|
{
|
|
|
|
|
struct status* s;
|
|
|
|
|
s = malloc(sizeof(*s));
|
|
|
|
|
memset(s,0,sizeof(*s));
|
|
|
|
|
|
|
|
|
|
s->id = -stub->id - 50;
|
|
|
|
|
s->account_id = -1;
|
|
|
|
|
s->published = time(NULL);
|
|
|
|
|
asprintf( &s->content, "Unable to load status #%d. View on original server at <a href='%s'>%s</a>",
|
|
|
|
|
stub->id,
|
|
|
|
|
stub->url, stub->url
|
|
|
|
|
);
|
|
|
|
|
s->sensitive = true;
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct status* status_from_activity( struct ap_activity* act )
|
|
|
|
|
{
|
|
|
|
@ -468,6 +486,7 @@ void status_remove_react( struct status* s, const char* react, struct account* a
|
|
|
|
|
/// Generate Undo Activity
|
|
|
|
|
|
|
|
|
|
// TODO: generate notification
|
|
|
|
|
/*
|
|
|
|
|
if( s->account_id == owner_account_id && a->id != owner_account_id ) {
|
|
|
|
|
// Create notification for liking the owner's post
|
|
|
|
|
struct notification* note = notification_new();
|
|
|
|
@ -477,7 +496,7 @@ void status_remove_react( struct status* s, const char* react, struct account* a
|
|
|
|
|
note->created_at = time(NULL);
|
|
|
|
|
notification_save( note );
|
|
|
|
|
notification_free( note );
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
struct status_react* re = NULL;
|
|
|
|
|
for( int i = 0; i < s->reacts.count; ++i ) {
|
|
|
|
@ -506,18 +525,21 @@ void status_add_like( struct status* s, struct account* a )
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( s->account_id == owner_account_id ) {
|
|
|
|
|
if( a->id != owner_account_id ) {
|
|
|
|
|
// Create notification for liking the owner's post
|
|
|
|
|
struct notification* note = notification_new();
|
|
|
|
|
note->type = nt_like;
|
|
|
|
|
note->account_id = a->id;
|
|
|
|
|
note->created_at = time(NULL);
|
|
|
|
|
notification_save( note );
|
|
|
|
|
notification_free( note );
|
|
|
|
|
if( !s->stub ) {
|
|
|
|
|
if( s->account_id == owner_account_id ) {
|
|
|
|
|
if( a->id != owner_account_id ) {
|
|
|
|
|
// Create notification for liking the owner's post
|
|
|
|
|
struct notification* note = notification_new();
|
|
|
|
|
note->type = nt_like;
|
|
|
|
|
note->account_id = a->id;
|
|
|
|
|
note->status_id = s->id;
|
|
|
|
|
note->created_at = time(NULL);
|
|
|
|
|
notification_save( note );
|
|
|
|
|
notification_free( note );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ap_activity_like( s );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ap_activity_like( s );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
status_save(s);
|
|
|
|
|