Commit 77b7dfbb authored by Michal Čihař's avatar Michal Čihař

Filter recent changes by subscriptions

Fixes #820
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent a2af18ff
...@@ -87,7 +87,7 @@ def home(request): ...@@ -87,7 +87,7 @@ def home(request):
) )
# Some stats # Some stats
last_changes = Change.objects.last_changes(request.user)[:10] last_changes = Change.objects.last_changes(request.user)
# Dashboard project/subproject view # Dashboard project/subproject view
componentlists = ComponentList.objects.all() componentlists = ComponentList.objects.all()
...@@ -107,6 +107,13 @@ def home(request): ...@@ -107,6 +107,13 @@ def home(request):
dashboard_choices[active_tab_id] = clist.name dashboard_choices[active_tab_id] = clist.name
subscribed_projects = request.user.profile.subscriptions.all() subscribed_projects = request.user.profile.subscriptions.all()
# Ensure ACL filtering applies (user could have been removed
# from the project meanwhile)
subscribed_projects.filter(id__in=projects.values_list('id'))
last_changes = last_changes.filter(
subproject__project__in=subscribed_projects
)
components_by_language = Translation.objects.filter( components_by_language = Translation.objects.filter(
language__in=request.user.profile.languages.all(), language__in=request.user.profile.languages.all(),
...@@ -128,7 +135,7 @@ def home(request): ...@@ -128,7 +135,7 @@ def home(request):
'index.html', 'index.html',
{ {
'projects': subproject_list or projects, 'projects': subproject_list or projects,
'last_changes': last_changes, 'last_changes': last_changes[:10],
'last_changes_url': '', 'last_changes_url': '',
'search_form': SiteSearchForm(), 'search_form': SiteSearchForm(),
'whiteboard_messages': wb_messages, 'whiteboard_messages': wb_messages,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment