diff options
-rw-r--r-- | data.c | 8 | ||||
-rw-r--r-- | html.c | 2 | ||||
-rw-r--r-- | snac.h | 1 |
3 files changed, 9 insertions, 2 deletions
@@ -1343,6 +1343,13 @@ int is_pinned(snac *user, const char *id) } +int is_pinned_by_md5(snac *user, const char *md5) +{ + xs *fn = xs_fmt("%s/pinned/%s.json", user->basedir, md5); + return !!(mtime(fn) != 0.0); +} + + int pin(snac *user, const char *id) /* pins a message */ { @@ -2436,7 +2443,6 @@ void purge_user(snac *snac) _purge_user_subdir(snac, "hidden", priv_days); _purge_user_subdir(snac, "private", priv_days); - _purge_user_subdir(snac, "pinned", pub_days); _purge_user_subdir(snac, "public", pub_days); const char *idxs[] = { "followers.idx", "private.idx", "public.idx", "pinned.idx", NULL }; @@ -1563,7 +1563,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int xs *msg = NULL; int status; - if (user) + if (user && !is_pinned_by_md5(user, v)) status = timeline_get_by_md5(user, v, &msg); else status = object_get_by_md5(v, &msg); @@ -130,6 +130,7 @@ int is_muted(snac *snac, const char *actor); int pin(snac *user, const char *id); int unpin(snac *user, const char *id); int is_pinned(snac *user, const char *id); +int is_pinned_by_md5(snac *user, const char *md5); xs_list *pinned_list(snac *user); int limited(snac *user, const char *id, int cmd); |