mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 02:42:47 +00:00
Modify group msg notification to make index friendly.
This commit is contained in:
@@ -6,15 +6,22 @@ from seahub.notifications.models import UserNotification
|
||||
def grpmsg_added_cb(sender, **kwargs):
|
||||
group_id = kwargs['group_id']
|
||||
from_email = kwargs['from_email']
|
||||
l = UserNotification.objects.filter(msg_type='group_msg', detail=group_id)
|
||||
if len(l) == 0:
|
||||
group_members = ccnet_threaded_rpc.get_group_members(int(group_id))
|
||||
for m in group_members:
|
||||
if from_email == m.user_name:
|
||||
continue
|
||||
group_members = ccnet_threaded_rpc.get_group_members(int(group_id))
|
||||
for m in group_members:
|
||||
if from_email == m.user_name:
|
||||
continue
|
||||
try:
|
||||
UserNotification.objects.get(to_user=m.user_name,
|
||||
msg_type='group_msg',
|
||||
detail=group_id)
|
||||
except UserNotification.DoesNotExist:
|
||||
n = UserNotification(to_user=m.user_name, msg_type='group_msg',
|
||||
detail=group_id)
|
||||
n.save()
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user