diff --git a/djangoproject/core/services/mail_services.py b/djangoproject/core/services/mail_services.py
index 4c28fc36..6d0ab977 100644
--- a/djangoproject/core/services/mail_services.py
+++ b/djangoproject/core/services/mail_services.py
@@ -87,6 +87,38 @@ def send_func(watch):
_notify_watchers(send_func, watches)
+def notifyWatchers_project_tag_added(user, project, tag, watches):
+ def send_func(watch):
+ if watch.user.id != user.id:
+ _send_mail_to_user(user=watch.user,
+ subject=user.getUserInfo().screenName + " added the tag [%s] to project [%s]" % (tag, project.name),
+ templateName='email/project_tag_added.html',
+ contextData={"project": project,
+ "user": user,
+ "you": watch.user,
+ "SITE_HOME": settings.SITE_HOME,
+ "tag": tag,
+ },
+ whentrue='receiveEmail_issue_work')
+ _notify_watchers(send_func, watches)
+
+
+def notifyWatchers_project_tag_removed(user, project, tag, watches):
+ def send_func(watch):
+ if watch.user.id != user.id:
+ _send_mail_to_user(user=watch.user,
+ subject=user.getUserInfo().screenName + " removed tag [%s] from project [%s]" % (tag, project.name),
+ templateName='email/project_tag_removed.html',
+ contextData={"project": project,
+ "user": user,
+ "you": watch.user,
+ "SITE_HOME": settings.SITE_HOME,
+ "tag": tag,
+ },
+ whentrue='receiveEmail_issue_work')
+ _notify_watchers(send_func, watches)
+
+
def notifyWatchers_acceptingpayments(solution, watches):
def send_func(watch):
if(watch.user.id != solution.programmer.id):
diff --git a/djangoproject/core/views/json_views.py b/djangoproject/core/views/json_views.py
index 7a77c1a2..875918a6 100644
--- a/djangoproject/core/views/json_views.py
+++ b/djangoproject/core/views/json_views.py
@@ -5,7 +5,7 @@
from django.http import HttpResponse
from django.utils.translation import ugettext as _
import json
-from core.services import issue_services, tag_services, activity_services, watch_services
+from core.services import issue_services, tag_services, activity_services, watch_services, mail_services
import traceback
import logging
from django.contrib.auth.decorators import login_required
@@ -79,6 +79,8 @@ def add_tag(request):
if not objtype in ['Project', 'Issue']:
raise BaseException('Wrong objtype: %s' % objtype)
tag_services.addTag(name, objtype, objid)
+ watches = watch_services.find_project_watches(project)
+ mail_services.notifyWatchers_project_tag_added(request.user, project, name, watches)
ActionLog.log_project_tag_added(user=request.user, project_id=objid, tag_name=name)
return HttpResponse('')
@@ -89,6 +91,8 @@ def remove_tag(request):
objtype = request.POST.get('objtype')
objid = int(request.POST.get('objid'))
tag_services.removeTag(name, objtype, objid)
+ watches = watch_services.find_project_watches(project)
+ mail_services.notifyWatchers_project_tag_removed(request.user, project, name, watches)
ActionLog.log_project_tag_removed(user=request.user, project_id=objid, tag_name=name)
return HttpResponse('')
diff --git a/djangoproject/templates/email/project_tag_added.html b/djangoproject/templates/email/project_tag_added.html
new file mode 100644
index 00000000..41388b7b
--- /dev/null
+++ b/djangoproject/templates/email/project_tag_added.html
@@ -0,0 +1,17 @@
+{% extends "email/base.html" %}
+{% block mainContent%}
+Hello {{ you.getUserInfo.screenName }}
+
+ {{ user.getUserInfo.screenName }}
+
+added the tag {{ tag }} to project
+{{ project.name }}
+project.
+
+We will let you know if there are any updates.
+
+
+{% include 'email/include/email_settings_notice.html' %}
+
+{% endblock mainContent%}
+
diff --git a/djangoproject/templates/email/project_tag_removed.html b/djangoproject/templates/email/project_tag_removed.html
new file mode 100644
index 00000000..dbaa136d
--- /dev/null
+++ b/djangoproject/templates/email/project_tag_removed.html
@@ -0,0 +1,17 @@
+{% extends "email/base.html" %}
+{% block mainContent%}
+Hello {{ you.getUserInfo.screenName }}
+
+ {{ user.getUserInfo.screenName }}
+
+removed tag {{ tag }} from project
+{{ project.name }}
+project.
+
+We will let you know if there are any updates.
+
+
+{% include 'email/include/email_settings_notice.html' %}
+
+{% endblock mainContent%}
+