commit 2076267

default  ·  2023-06-15 02:56:44 +0000 UTC
parent dccb6cd
Avoid returning 'ghost' no-longer-followers in followers_list().
1 files changed,  +8, -3
M data.c
M data.c
+8, -3
 1@@ -933,10 +933,15 @@ xs_list *follower_list(snac *snac)
 2         xs *a_obj = NULL;
 3 
 4         if (valid_status(object_get_by_md5(v, &a_obj))) {
 5-            char *actor = xs_dict_get(a_obj, "id");
 6+            const char *actor = xs_dict_get(a_obj, "id");
 7 
 8-            if (!xs_is_null(actor))
 9-                fwers = xs_list_append(fwers, actor);
10+            if (!xs_is_null(actor)) {
11+                /* check if the actor is still cached */
12+                xs *fn = xs_fmt("%s/followers/%s.json", snac->basedir, v);
13+
14+                if (mtime(fn) > 0.0)
15+                    fwers = xs_list_append(fwers, actor);
16+            }
17         }
18     }
19