mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-28 23:53:36 +00:00
Undo for Likes and Announces are no longer dropped.
This commit is contained in:
parent
1a9bb5fd07
commit
46f2e324d8
2 changed files with 15 additions and 0 deletions
|
@ -1941,6 +1941,8 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(type, "Undo") == 0) { /** **/
|
if (strcmp(type, "Undo") == 0) { /** **/
|
||||||
|
char *id = xs_dict_get(object, "object");
|
||||||
|
|
||||||
if (xs_type(object) != XSTYPE_DICT)
|
if (xs_type(object) != XSTYPE_DICT)
|
||||||
utype = "Follow";
|
utype = "Follow";
|
||||||
|
|
||||||
|
@ -1952,6 +1954,18 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
||||||
else
|
else
|
||||||
snac_log(snac, xs_fmt("error deleting follower %s", actor));
|
snac_log(snac, xs_fmt("error deleting follower %s", actor));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (strcmp(utype, "Like") == 0) { /** **/
|
||||||
|
int status = object_unadmire(id, actor, 1);
|
||||||
|
|
||||||
|
snac_log(snac, xs_fmt("Unlike for %s %d", id, status));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (strcmp(utype, "Announce") == 0) { /** **/
|
||||||
|
int status = object_unadmire(id, actor, 0);
|
||||||
|
|
||||||
|
snac_log(snac, xs_fmt("Unboost for %s %d", id, status));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
snac_debug(snac, 1, xs_fmt("ignored 'Undo' for object type '%s'", utype));
|
snac_debug(snac, 1, xs_fmt("ignored 'Undo' for object type '%s'", utype));
|
||||||
}
|
}
|
||||||
|
|
1
data.c
1
data.c
|
@ -916,6 +916,7 @@ int object_unadmire(const char *id, const char *actor, int like)
|
||||||
fn = xs_replace_i(fn, ".json", like ? "_l.idx" : "_a.idx");
|
fn = xs_replace_i(fn, ".json", like ? "_l.idx" : "_a.idx");
|
||||||
|
|
||||||
status = index_del(fn, actor);
|
status = index_del(fn, actor);
|
||||||
|
index_gc(fn);
|
||||||
|
|
||||||
srv_debug(0,
|
srv_debug(0,
|
||||||
xs_fmt("object_unadmire (%s) %s %s %d", like ? "Like" : "Announce", actor, fn, status));
|
xs_fmt("object_unadmire (%s) %s %s %d", like ? "Like" : "Announce", actor, fn, status));
|
||||||
|
|
Loading…
Reference in a new issue