got the read posts filering on main, topics, and community pages

This commit is contained in:
Alan Roberts 2024-09-27 18:12:47 -04:00
parent ccbc0b4b22
commit c6fb8fc554
3 changed files with 21 additions and 0 deletions

View file

@ -228,6 +228,13 @@ def show_community(community: Community):
posts = posts.filter(Post.nsfl == False) posts = posts.filter(Post.nsfl == False)
if current_user.hide_nsfw == 1: if current_user.hide_nsfw == 1:
posts = posts.filter(Post.nsfw == False) posts = posts.filter(Post.nsfw == False)
if current_user.hide_read_posts:
cu_rp = current_user.read_post.all()
cu_rp_ids = []
for p in cu_rp:
cu_rp_ids.append(p.id)
for p_id in cu_rp_ids:
posts = posts.filter(Post.id != p_id)
content_filters = user_filters_posts(current_user.id) content_filters = user_filters_posts(current_user.id)
posts = posts.filter(Post.deleted == False) posts = posts.filter(Post.deleted == False)

View file

@ -71,6 +71,13 @@ def home_page(sort, view_filter):
posts = posts.filter(Post.nsfl == False) posts = posts.filter(Post.nsfl == False)
if current_user.hide_nsfw == 1: if current_user.hide_nsfw == 1:
posts = posts.filter(Post.nsfw == False) posts = posts.filter(Post.nsfw == False)
if current_user.hide_read_posts:
cu_rp = current_user.read_post.all()
cu_rp_ids = []
for p in cu_rp:
cu_rp_ids.append(p.id)
for p_id in cu_rp_ids:
posts = posts.filter(Post.id != p_id)
domains_ids = blocked_domains(current_user.id) domains_ids = blocked_domains(current_user.id)
if domains_ids: if domains_ids:

View file

@ -65,6 +65,13 @@ def show_topic(topic_path):
posts = posts.filter(Post.nsfl == False) posts = posts.filter(Post.nsfl == False)
if current_user.hide_nsfw == 1: if current_user.hide_nsfw == 1:
posts = posts.filter(Post.nsfw == False) posts = posts.filter(Post.nsfw == False)
if current_user.hide_read_posts:
cu_rp = current_user.read_post.all()
cu_rp_ids = []
for p in cu_rp:
cu_rp_ids.append(p.id)
for p_id in cu_rp_ids:
posts = posts.filter(Post.id != p_id)
posts = posts.filter(Post.deleted == False) posts = posts.filter(Post.deleted == False)
content_filters = user_filters_posts(current_user.id) content_filters = user_filters_posts(current_user.id)