On Update + Person, call object_del() before actor_add().

This commit is contained in:
default 2022-11-25 12:09:30 +01:00
parent 200a6a0c91
commit e2c332c68a
3 changed files with 7 additions and 0 deletions

View file

@ -917,7 +917,9 @@ int process_message(snac *snac, char *msg, char *req)
else else
if (strcmp(type, "Update") == 0) { if (strcmp(type, "Update") == 0) {
if (strcmp(utype, "Person") == 0) { if (strcmp(utype, "Person") == 0) {
object_del(actor);
actor_add(snac, actor, xs_dict_get(msg, "object")); actor_add(snac, actor, xs_dict_get(msg, "object"));
snac_log(snac, xs_fmt("updated actor %s", actor)); snac_log(snac, xs_fmt("updated actor %s", actor));
} }
else else

3
data.c
View file

@ -433,6 +433,9 @@ int object_add(const char *id, d_char *obj)
return 204; /* No content */ return 204; /* No content */
} }
// if (xs_dict_get(obj, "suspended") != NULL)
// srv_log(xs_fmt("object_add suspended: true %s", id));
if ((f = fopen(fn, "w")) != NULL) { if ((f = fopen(fn, "w")) != NULL) {
flock(fileno(f), LOCK_EX); flock(fileno(f), LOCK_EX);

2
snac.h
View file

@ -57,6 +57,8 @@ int index_del(const char *fn, const char *md5);
d_char *index_list(const char *fn, int max); d_char *index_list(const char *fn, int max);
d_char *index_list_desc(const char *fn, int max); d_char *index_list_desc(const char *fn, int max);
int object_del(const char *id);
int follower_add(snac *snac, char *actor, char *msg); int follower_add(snac *snac, char *actor, char *msg);
int follower_del(snac *snac, char *actor); int follower_del(snac *snac, char *actor);
int follower_check(snac *snac, char *actor); int follower_check(snac *snac, char *actor);