diff --git a/templates/base_project.html b/templates/base_project.html
index 3fa4a5b..9b9b11a 100644
--- a/templates/base_project.html
+++ b/templates/base_project.html
@@ -19,11 +19,13 @@
{% endcomment %}
-{% if request.user in project.subscribers.all %}
+{% if request.user.is_authenticated %}
+{% if request.user.email and request.user in project.subscribers.all %}
Unwatch
{% else %}
Watch
{% endif %}
+{% endif %}
{% if perm.manage_project_permission or perm.modify_project or perm.delete_project %}
diff --git a/templates/tracker/issue_details.html b/templates/tracker/issue_details.html
index 7cad4ba..3b72b7f 100644
--- a/templates/tracker/issue_details.html
+++ b/templates/tracker/issue_details.html
@@ -193,7 +193,7 @@
- {% 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 %}
diff --git a/tracker/views.py b/tracker/views.py
index dd1054a..5f161e9 100644
--- a/tracker/views.py
+++ b/tracker/views.py
@@ -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: