Commit a7f83de7 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis Committed by Georgios D. Tsoukalas
Browse files

Notify for project enrollment

parent 356c9835
......@@ -69,7 +69,7 @@ from astakos.im.models import (
AstakosUser, ProjectMembership, ProjectApplication, Project,
PendingMembershipError, get_resource_names, new_chain)
from astakos.im.project_notif import (
membership_change_notify,
membership_change_notify, membership_enroll_notify,
application_submit_notify, application_approve_notify,
application_deny_notify,
project_termination_notify, project_suspension_notify)
......@@ -585,8 +585,8 @@ def enroll_member(project_id, user, request_user=None):
raise PermissionDenied(m)
membership.accept()
membership_enroll_notify(project, membership.person)
# TODO send proper notification
return membership
def leave_project_checks(project):
......
......@@ -10,6 +10,11 @@ MEM_CHANGE_NOTIF = {
'template': 'im/projects/project_membership_change_notification.txt',
}
MEM_ENROLL_NOTIF = {
'subject' : _(settings.PROJECT_MEMBERSHIP_ENROLL_SUBJECT),
'template': 'im/projects/project_membership_enroll_notification.txt',
}
SENDER = settings.SERVER_EMAIL
ADMINS = settings.ADMINS
......@@ -25,6 +30,18 @@ def membership_change_notify(project, user, action):
except NotificationError, e:
logger.error(e.message)
def membership_enroll_notify(project, user):
try:
notification = build_notification(
SENDER,
[user.email],
MEM_ENROLL_NOTIF['subject'] % project.__dict__,
template= MEM_ENROLL_NOTIF['template'],
dictionary={'object':project})
notification.send()
except NotificationError, e:
logger.error(e.message)
def application_submit_notify(application):
try:
notification = build_notification(
......
......@@ -161,6 +161,9 @@ PROJECT_SUSPENSION_SUBJECT = getattr(
PROJECT_MEMBERSHIP_CHANGE_SUBJECT = getattr(
settings, 'ASTAKOS_PROJECT_MEMBERSHIP_CHANGE_SUBJECT',
'%s alpha2 testing project membership changed (%%(name)s)' % SITENAME)
PROJECT_MEMBERSHIP_ENROLL_SUBJECT = getattr(
settings, 'ASTAKOS_PROJECT_MEMBERSHIP_ENROLL_SUBJECT',
'%s alpha2 testing project enrollment (%%(name)s)' % SITENAME)
# Set the quota holder component URI
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
......
--- A translation in English follows ---
Έχετε εγγραφεί στο project {{object.name}}.
--
You have been enrolled in project {{object.name}}.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment