forked from mirrors/bookwyrm
Only show dms in dm page
This commit is contained in:
parent
2a5d4b83d8
commit
779581c6f4
3 changed files with 11 additions and 4 deletions
|
@ -28,7 +28,7 @@ class Feed(View):
|
|||
|
||||
if tab == 'home':
|
||||
activities = get_activity_feed(
|
||||
request.user, following_only=True, hide_dms=True)
|
||||
request.user, following_only=True)
|
||||
elif tab == 'local':
|
||||
activities = get_activity_feed(
|
||||
request.user, privacy=['public', 'followers'], local_only=True)
|
||||
|
|
|
@ -115,7 +115,7 @@ def privacy_filter(viewer, queryset, privacy_levels=None, following_only=False):
|
|||
|
||||
def get_activity_feed(
|
||||
user, privacy=None, local_only=False, following_only=False,
|
||||
queryset=None, hide_dms=False):
|
||||
queryset=None):
|
||||
''' get a filtered queryset of statuses '''
|
||||
if not queryset:
|
||||
queryset = models.Status.objects.select_subclasses()
|
||||
|
@ -127,8 +127,16 @@ def get_activity_feed(
|
|||
queryset = privacy_filter(
|
||||
user, queryset, privacy, following_only=following_only)
|
||||
|
||||
if hide_dms:
|
||||
# only show dms if we only want dms
|
||||
if privacy == ['direct']:
|
||||
# dms are direct statuses not related to books
|
||||
queryset = queryset.filter(
|
||||
review__isnull=True,
|
||||
comment__isnull=True,
|
||||
quotation__isnull=True,
|
||||
generatednote__isnull=True,
|
||||
)
|
||||
else:
|
||||
queryset = queryset.exclude(
|
||||
review__isnull=True,
|
||||
comment__isnull=True,
|
||||
|
|
|
@ -72,7 +72,6 @@ class User(View):
|
|||
activities = get_activity_feed(
|
||||
request.user,
|
||||
queryset=user.status_set.select_subclasses(),
|
||||
hide_dms=True
|
||||
)
|
||||
paginated = Paginator(activities, PAGE_LENGTH)
|
||||
goal = models.AnnualGoal.objects.filter(
|
||||
|
|
Loading…
Reference in a new issue