mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
Merge pull request #5063 from moschlar/patch-6
Fix collaboration notice sending (Closes: #5062)
This commit is contained in:
@@ -323,9 +323,8 @@ class Command(BaseCommand):
|
|||||||
continue
|
continue
|
||||||
user_name = email2nickname(to_user)
|
user_name = email2nickname(to_user)
|
||||||
contact_email = Profile.objects.get_contact_email_by_user(to_user)
|
contact_email = Profile.objects.get_contact_email_by_user(to_user)
|
||||||
to_user = contact_email # use contact email if any
|
|
||||||
c = {
|
c = {
|
||||||
'to_user': to_user,
|
'to_user': contact_email,
|
||||||
'notice_count': len(notices),
|
'notice_count': len(notices),
|
||||||
'notices': notices,
|
'notices': notices,
|
||||||
'user_name': user_name,
|
'user_name': user_name,
|
||||||
@@ -334,15 +333,15 @@ class Command(BaseCommand):
|
|||||||
try:
|
try:
|
||||||
send_html_email(_('New notice on %s') % get_site_name(),
|
send_html_email(_('New notice on %s') % get_site_name(),
|
||||||
'notifications/notice_email.html', c,
|
'notifications/notice_email.html', c,
|
||||||
None, [to_user])
|
None, [contact_email])
|
||||||
# set new last_emailed_time
|
# set new last_emailed_time
|
||||||
UserOptions.objects.set_collaborate_last_emailed_time(
|
UserOptions.objects.set_collaborate_last_emailed_time(
|
||||||
to_user, now)
|
to_user, now)
|
||||||
logger.info('Successfully sent email to %s' % to_user)
|
logger.info('Successfully sent email to %s' % contact_email)
|
||||||
self.stdout.write('[%s] Successfully sent email to %s' % (str(datetime.datetime.now()), to_user))
|
self.stdout.write('[%s] Successfully sent email to %s' % (str(datetime.datetime.now()), contact_email))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Failed to send email to %s, error detail: %s' % (to_user, e))
|
logger.error('Failed to send email to %s, error detail: %s' % (contact_email, e))
|
||||||
self.stderr.write('[%s] Failed to send email to %s, error detail: %s' % (str(datetime.datetime.now()), to_user, e))
|
self.stderr.write('[%s] Failed to send email to %s, error detail: %s' % (str(datetime.datetime.now()), contact_email, e))
|
||||||
|
|
||||||
# restore current language
|
# restore current language
|
||||||
translation.activate(cur_language)
|
translation.activate(cur_language)
|
||||||
|
Reference in New Issue
Block a user