commit 2c34ec8

default  ·  2022-11-25 20:21:59 +0000 UTC
parent c0e3193
New function timeline_update_indexes().
1 files changed,  +5, -5
M data.c
M data.c
+5, -5
 1@@ -913,11 +913,9 @@ int _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referre
 2 }
 3 
 4 
 5-void timeline_object_add(snac *snac, const char *id, char *msg)
 6-/* adds an object and update the user indexes */
 7+void timeline_update_indexes(snac *snac, const char *id)
 8+/* updates the indexes */
 9 {
10-    object_add(id, msg);
11-
12     /* add to the private index */
13     xs *idx = xs_fmt("%s/private.idx", snac->basedir);
14     index_add(idx, id);
15@@ -969,7 +967,8 @@ int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer
16     if ((ret = _timeline_write(snac, id, msg, parent, referrer))) {
17         snac_debug(snac, 1, xs_fmt("timeline_add %s", id));
18 
19-        timeline_object_add(snac, id, o_msg);
20+        object_add(id, o_msg);
21+        timeline_update_indexes(snac, id);
22     }
23 
24     return ret;
25@@ -1024,6 +1023,7 @@ void timeline_admire(snac *snac, char *id, char *admirer, int like)
26     else
27         snac_log(snac, xs_fmt("timeline_admire ignored for unknown object %s", id));
28 
29+    timeline_update_indexes(snac, id);
30     object_admire(id, admirer, like);
31 }
32