Merge lp:~bhavesh-goyal093/postorius/fixed-postorius-method-decorators into lp:postorius

Proposed by Bhavesh Goyal
Status: Merged
Merged at revision: 221
Proposed branch: lp:~bhavesh-goyal093/postorius/fixed-postorius-method-decorators
Merge into: lp:postorius
Diff against target: 38 lines (+9/-4)
2 files modified
src/postorius/auth/ (+8/-3)
src/postorius/templates/postorius/menu/list_nav.html (+1/-1)
To merge this branch: bzr merge lp:~bhavesh-goyal093/postorius/fixed-postorius-method-decorators
Reviewer Review Type Date Requested Status
Terri Approve
Review via email:

Description of the change

Fixed Bug #1435062 which caused postorius to show incorrect nav bar view for members posessing different roles.
The solution was found in correcting permissions for list_nav template and fixing method decorators for list_moderator_required which earlier didn't set is_list_owner to be True even if the user was the owner and as a result the view was shown to be incorrect.
Now the attributes are set correctly according to the roles and the nav bar sows correct view or different and multiple roles.

To post a comment you must log in.
Revision history for this message
Terri (terriko) wrote :

Whoops! Looks like you used tabs instead of spaces. I'll fix it when I do the merge, assuming my tests pass.

Revision history for this message
Bhavesh Goyal (bhavesh-goyal093) wrote :

Sorry for the tabs! I ll take care of them next time onwards...

Revision history for this message
Terri (terriko) wrote :

The update seems to have fixed the test errors I saw earlier; thanks!

Revision history for this message
Terri (terriko) wrote :

Also, it would be awesome if I had some tests for this behaviour. I'll open a separate bug for this.

Revision history for this message
Terri (terriko) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/postorius/auth/'
2--- src/postorius/auth/ 2015-02-09 14:35:44 +0000
3+++ src/postorius/auth/ 2015-04-13 21:09:22 +0000
4@@ -82,13 +82,18 @@
5 if getattr(user, 'is_list_owner', None):
6 return fn(*args, **kwargs)
7 if getattr(user, 'is_list_moderator', None):
8- return fn(*args, **kwargs)
9+ return fn(*args, **kwargs)
10 mlist = List.objects.get_or_404(fqdn_listname=list_id)
11 if not in mlist.moderators and \
12 not in mlist.owners:
13 raise PermissionDenied
14- else:
15- user.is_list_moderator = True
16+ else:
17+ if in mlist.moderators and \
18+ not in mlist.owners:
19+ user.is_list_moderator = True
20+ else:
21+ user.is_list_moderator = True
22+ user.is_list_owner = True
23 return fn(*args, **kwargs)
24 return wrapper
27=== modified file 'src/postorius/templates/postorius/menu/list_nav.html'
28--- src/postorius/templates/postorius/menu/list_nav.html 2015-04-13 19:38:03 +0000
29+++ src/postorius/templates/postorius/menu/list_nav.html 2015-04-13 21:09:22 +0000
30@@ -9,7 +9,7 @@
31 {% if user.is_superuser or user.is_list_owner %}
32 <li class="mm_nav_item"><a class="{% nav_active_class current 'list_members' %}" href="{% url 'list_members' list.list_id %}">{% trans "Members" %}</a></li>
33 {% endif %}
34- {% if user.is_superuser or user.is_list_moderator %}
35+ {% if user.is_superuser or user.is_list_owner or user.is_list_moderator %}
36 <li class="mm_nav_item"><a class="{% nav_active_class current 'list_held_messages' %}" href="{% url 'list_held_messages' list.list_id %}">{% trans "Held Messages" %}</a></li>
37 {% endif %}
38 {% if user.is_superuser or user.is_list_owner %}


People subscribed via source and target branches