1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-06-28 16:08:25 +00:00
seahub/organizations/handlers.py

26 lines
695 B
Python
Raw Normal View History

2012-07-27 09:59:31 +00:00
# encoding: utf-8
2012-09-06 08:57:54 +00:00
import simplejson as json
2012-07-27 09:59:31 +00:00
from signals import org_user_added
from seahub.notifications.models import UserNotification
from seaserv import get_org_by_id
def org_user_added_cb(sender, **kwargs):
org_id = kwargs['org_id']
from_email = kwargs['from_email']
to_email = kwargs['to_email']
org = get_org_by_id(org_id)
if not org:
return
2012-09-06 08:57:54 +00:00
msg_dict = {'from_email': from_email,
'org_name': org.org_name,
'org_prefix': org.url_prefix,
'creator': org.creator}
n = UserNotification(to_user=to_email, msg_type='org_join_msg',
detail=json.dumps(msg_dict))
2012-07-27 09:59:31 +00:00
n.save()