mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Pinned posts are never purged.
This commit is contained in:
parent
5afa5ab071
commit
f8c62fe210
8
data.c
8
data.c
@ -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 };
|
||||
|
2
html.c
2
html.c
@ -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);
|
||||
|
1
snac.h
1
snac.h
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user