mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
adding read-posts filtering to domain page
This commit is contained in:
parent
9185a56267
commit
779def72aa
1 changed files with 10 additions and 0 deletions
|
@ -38,6 +38,16 @@ def show_domain(domain_id):
|
||||||
content_filters = user_filters_posts(current_user.id)
|
content_filters = user_filters_posts(current_user.id)
|
||||||
else:
|
else:
|
||||||
content_filters = {}
|
content_filters = {}
|
||||||
|
|
||||||
|
# don't show posts a user has already interacted with
|
||||||
|
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)
|
||||||
|
|
||||||
# pagination
|
# pagination
|
||||||
posts = posts.paginate(page=page, per_page=100, error_out=False)
|
posts = posts.paginate(page=page, per_page=100, error_out=False)
|
||||||
next_url = url_for('domain.show_domain', domain_id=domain_id, page=posts.next_num) if posts.has_next else None
|
next_url = url_for('domain.show_domain', domain_id=domain_id, page=posts.next_num) if posts.has_next else None
|
||||||
|
|
Loading…
Add table
Reference in a new issue