Skip to content

Commit

Permalink
Fix bug with reader role #4380
Browse files Browse the repository at this point in the history
  • Loading branch information
joemull authored and ajrbyers committed Dec 2, 2024
1 parent 628737c commit f47441b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ def is_preprint_editor(self, request):

return False

def is_reader(self, request):
return self.check_role(request.journal, 'reader', staff_override=False)

def snapshot_self(self, article, force_update=True):
frozen_dict = {
'name_prefix': self.name_prefix,
Expand Down
1 change: 1 addition & 0 deletions src/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ def edit_profile(request):
'staff_group_membership_form': staff_group_membership_form,
'user_to_edit': user,
'send_reader_notifications': send_reader_notifications,
'user_is_reader': user.is_reader(request),
}

return render(request, template, context)
Expand Down
2 changes: 1 addition & 1 deletion src/templates/admin/core/accounts/edit_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h2>{% trans "Register for Article Notifications" %}</h2>
published in this journal.
{% endblocktrans %}</p>
{% csrf_token %}
{% if reader %}
{% if user_is_reader %}
<button name="unsubscribe" class="button secondary">
{% trans "Unsubscribe from Article Notifications" %}
</button>
Expand Down

0 comments on commit f47441b

Please sign in to comment.