redirect to profile if no email when subscribe
This commit is contained in:
parent
432db03fc0
commit
aef23ff7ae
3 changed files with 12 additions and 2 deletions
|
@ -19,11 +19,13 @@
|
|||
</form>
|
||||
{% endcomment %}
|
||||
|
||||
{% if request.user in project.subscribers.all %}
|
||||
{% if request.user.is_authenticated %}
|
||||
{% if request.user.email and request.user in project.subscribers.all %}
|
||||
<li><a href="{% url 'unsubscribe-project' project.name %}?next={{ request.get_full_path }}"><span class="glyphicon glyphicon-eye-close"></span> Unwatch</a></li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'subscribe-project' project.name %}?next={{ request.get_full_path }}"><span class="glyphicon glyphicon-eye-open"></span> Watch</a></li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if perm.manage_project_permission or perm.modify_project or perm.delete_project %}
|
||||
<li class="dropdown">
|
||||
|
|
|
@ -193,7 +193,7 @@
|
|||
</h5>
|
||||
<div class="row">
|
||||
<span style="display: inline-block; margin-left: 14px;"></span>
|
||||
{% if request.user in project.subscribers.all %}
|
||||
{% if request.user.email and request.user in project.subscribers.all %}
|
||||
Subscribed to the project
|
||||
{% else %}
|
||||
{% if request.user in issue.subscribers.all %}
|
||||
|
|
|
@ -121,6 +121,10 @@ def project_delete(request, project):
|
|||
@login_required
|
||||
def project_subscribe(request, project):
|
||||
|
||||
if not request.user.email:
|
||||
messages.error(request, 'You must set an email address in order to receive notifications.')
|
||||
return redirect('profile')
|
||||
|
||||
if project.subscribers.filter(pk=request.user.pk).exists():
|
||||
messages.warning(request,
|
||||
'You are already subscribed to this project.')
|
||||
|
@ -531,6 +535,10 @@ def issue_subscribe(request, project, issue):
|
|||
|
||||
issue = get_object_or_404(Issue, project=project, id=issue)
|
||||
|
||||
if not request.user.email:
|
||||
messages.error(request, 'You must set an email address in order to receive notifications.')
|
||||
return redirect('profile')
|
||||
|
||||
if issue.subscribers.filter(pk=request.user.pk).exists():
|
||||
messages.warning(request, 'You are already subscribed to this issue.')
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue