1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 08:16:07 +00:00

Merge pull request #1635 from haiwen/lang_email

[language] send email
This commit is contained in:
xiez
2017-06-13 10:37:04 +08:00
committed by GitHub
2 changed files with 9 additions and 2 deletions

View File

@@ -279,6 +279,9 @@ SHARE_LINK_PASSWORD_MIN_LENGTH = 8
# enable or disable share link audit
ENABLE_SHARE_LINK_AUDIT = False
# Control the language that send email. Default to user's current language.
SHARE_LINK_EMAIL_LANGUAGE = ''
# check virus for files uploaded form upload link
ENABLE_UPLOAD_LINK_VIRUS_CHECK = False

View File

@@ -9,7 +9,7 @@ from constance import config
from django.core.cache import cache
from django.http import HttpResponse, HttpResponseRedirect, Http404, \
HttpResponseBadRequest
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext as _, activate
from django.contrib import messages
from django.utils import timezone
from django.utils.html import escape
@@ -31,7 +31,8 @@ from seahub.utils import string2list, gen_shared_link, \
is_valid_username, is_valid_email, send_html_email, is_org_context, \
gen_token, normalize_cache_key
from seahub.utils.mail import send_html_email_with_dj_template, MAIL_PRIORITY
from seahub.settings import SITE_ROOT, REPLACE_FROM_EMAIL, ADD_REPLY_TO_HEADER
from seahub.settings import SITE_ROOT, REPLACE_FROM_EMAIL, \
ADD_REPLY_TO_HEADER, SHARE_LINK_EMAIL_LANGUAGE
from seahub.profile.models import Profile
# Get an instance of a logger
@@ -149,6 +150,9 @@ def send_shared_link(request):
send_failed.append(to_email)
continue
if SHARE_LINK_EMAIL_LANGUAGE:
activate(SHARE_LINK_EMAIL_LANGUAGE)
# Add email to contacts.
mail_sended.send(sender=None, user=request.user.username,
email=to_email)