Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gjl2004yn
jumpserver
提交
243eedc4
J
jumpserver
项目概览
gjl2004yn
/
jumpserver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jumpserver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
243eedc4
编写于
1月 18, 2021
作者:
B
Bai
提交者:
Jiangjie.Bai
1月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf: 优化工单body html显示格式及翻译信息
上级
230ef2f6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
231 addition
and
167 deletion
+231
-167
apps/locale/zh/LC_MESSAGES/django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
apps/locale/zh/LC_MESSAGES/django.po
apps/locale/zh/LC_MESSAGES/django.po
+144
-55
apps/tickets/handler/apply_application.py
apps/tickets/handler/apply_application.py
+16
-16
apps/tickets/handler/apply_asset.py
apps/tickets/handler/apply_asset.py
+19
-17
apps/tickets/handler/base.py
apps/tickets/handler/base.py
+32
-34
apps/tickets/handler/login_confirm.py
apps/tickets/handler/login_confirm.py
+4
-4
apps/tickets/signals_handler/ticket.py
apps/tickets/signals_handler/ticket.py
+0
-18
apps/tickets/utils.py
apps/tickets/utils.py
+16
-23
未找到文件。
apps/locale/zh/LC_MESSAGES/django.mo
浏览文件 @
243eedc4
无法预览此类型文件
apps/locale/zh/LC_MESSAGES/django.po
浏览文件 @
243eedc4
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-18 1
4:5
2+0800\n"
"POT-Creation-Date: 2021-01-18 1
6:4
2+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n"
...
...
@@ -2839,6 +2839,137 @@ msgstr "拒绝"
msgid "Closed"
msgstr "关闭"
#: tickets/handler/apply_application.py:55
msgid "Applied category"
msgstr "申请的种类"
#: tickets/handler/apply_application.py:56
msgid "Applied type"
msgstr "申请的类型"
#: tickets/handler/apply_application.py:57
msgid "Applied application group"
msgstr "申请的应用组"
#: tickets/handler/apply_application.py:58 tickets/handler/apply_asset.py:59
msgid "Applied system user group"
msgstr "申请的系统用户组"
#: tickets/handler/apply_application.py:59 tickets/handler/apply_asset.py:61
msgid "Applied date start"
msgstr "申请的开始日期"
#: tickets/handler/apply_application.py:60 tickets/handler/apply_asset.py:62
msgid "Applied date expired"
msgstr "申请的失效日期"
#: tickets/handler/apply_application.py:75
msgid "Approved applications"
msgstr "批准的应用"
#: tickets/handler/apply_application.py:76 tickets/handler/apply_asset.py:79
msgid "Approved system users"
msgstr "批准的系统用户"
#: tickets/handler/apply_application.py:77 tickets/handler/apply_asset.py:81
msgid "Approved date start"
msgstr "批准的开始日期"
#: tickets/handler/apply_application.py:78 tickets/handler/apply_asset.py:82
msgid "Approved date expired"
msgstr "批准的失效日期"
#: tickets/handler/apply_application.py:95 tickets/handler/apply_asset.py:98
msgid "Created by ticket ({}) ({})"
msgstr "通过工单创建 ({}) ({})"
#: tickets/handler/apply_application.py:99 tickets/handler/apply_asset.py:102
msgid ""
"Created by the ticket, ticket title: {}, ticket applicant: {}, ticket "
"processor: {}, ticket ID: {}"
msgstr ""
"通过工单创建, 工单标题: {}, 工单申请人: {}, 工单处理人: {}, 工单 ID: {}"
#: tickets/handler/apply_asset.py:57
msgid "Applied IP group"
msgstr "申请的IP组"
#: tickets/handler/apply_asset.py:58
msgid "Applied hostname group"
msgstr "申请的主机名组"
#: tickets/handler/apply_asset.py:60
msgid "Applied actions"
msgstr "申请的动作"
#: tickets/handler/apply_asset.py:78
msgid "Approved assets"
msgstr "批准的资产"
#: tickets/handler/apply_asset.py:80
msgid "Approved actions"
msgstr "批准的动作"
#: tickets/handler/base.py:62
msgid "User {} {} the ticket"
msgstr "用户 {} {} 这个工单"
#: tickets/handler/base.py:89
msgid "Ticket basic info"
msgstr "工单基本信息"
#: tickets/handler/base.py:90
msgid "Ticket title"
msgstr "工单标题"
#: tickets/handler/base.py:91
msgid "Ticket type"
msgstr "工单类型"
#: tickets/handler/base.py:92
msgid "Ticket applicant"
msgstr "工单申请人"
#: tickets/handler/base.py:93
msgid "Ticket assignees"
msgstr "工单受理人"
#: tickets/handler/base.py:94
msgid "Ticket processor"
msgstr "工单处理人"
#: tickets/handler/base.py:94
msgid "No"
msgstr "无"
#: tickets/handler/base.py:95
msgid "Ticket action"
msgstr "工单动作"
#: tickets/handler/base.py:96
msgid "Ticket status"
msgstr "工单状态"
#: tickets/handler/base.py:114
msgid "Ticket applied info"
msgstr "工单申请信息"
#: tickets/handler/base.py:124
msgid "Ticket approved info"
msgstr "工单批准信息"
#: tickets/handler/login_confirm.py:16
msgid "Applied login IP"
msgstr "申请的登录IP"
#: tickets/handler/login_confirm.py:17
msgid "Applied login city"
msgstr "申请的登录城市"
#: tickets/handler/login_confirm.py:18
msgid "Applied login datetime"
msgstr "申请的登录日期"
#: tickets/models/comment.py:19
msgid "User display name"
msgstr "用户显示名称"
...
...
@@ -2974,65 +3105,23 @@ msgstr "所有受理人都不属于组织 `{}` 下的管理员"
#: tickets/utils.py:21
msgid "New Ticket: {} ({})"
msgstr "新
建
工单: {} ({})"
msgstr "新工单: {} ({})"
#: tickets/utils.py:26
#, python-brace-format
msgid ""
"<div>\n"
" <p>Your has a new ticket</p>\n"
" <div>\n"
" <b>Ticket:</b> \n"
" <br/>\n"
" {body}\n"
" <br/>\n"
" <a href={ticket_detail_url}>click here to review</a> \n"
" </div>\n"
" </div>\n"
" "
msgstr ""
"<div>\n"
" <p>你有一个新工单</p>\n"
" <div>\n"
" <b>工单:</b> \n"
" <br/>\n"
" {body}\n"
" <br/>\n"
" <a href={ticket_detail_url}>点击查看</a> \n"
" </div>\n"
" </div>\n"
" "
#: tickets/utils.py:33
msgid "Your has a new ticket, from applicant - {}"
msgstr "你有一个新的工单, 来自申请人 - {}"
#: tickets/utils.py:51
#: tickets/utils.py:35
msgid "click here to review"
msgstr "点击查看"
#: tickets/utils.py:48
msgid "Ticket has processed: {} ({})"
msgstr "工单已处理: {} ({})"
#: tickets/utils.py:53
#, python-brace-format
msgid ""
"\n"
" <div>\n"
" <p>Your ticket has been processed</p>\n"
" <div>\n"
" <b>Ticket:</b> \n"
" <br/>\n"
" {body}\n"
" <br/>\n"
" </div>\n"
" </div>\n"
" "
msgstr ""
"\n"
" <div>\n"
" <p>你的工单已被处理</p>\n"
" <div>\n"
" <b>工单:</b> \n"
" <br/>\n"
" {body}\n"
" <br/>\n"
" </div>\n"
" </div>\n"
" "
#: tickets/utils.py:57
msgid "Your ticket has been ({}) processed"
msgstr "你的工单已被 ({}) 处理"
#: users/api/user.py:199
msgid "Could not reset self otp, use profile reset instead"
...
...
apps/tickets/handler/apply_application.py
浏览文件 @
243eedc4
from
django.utils.translation
import
ugettext
as
_
_
from
django.utils.translation
import
ugettext
as
_
from
orgs.utils
import
tmp_to_org
,
tmp_to_root_org
from
applications.models
import
Application
from
applications.const
import
ApplicationCategoryChoices
,
ApplicationTypeChoices
...
...
@@ -52,12 +52,12 @@ class Handler(BaseHandler):
{}: {},
{}: {},
'''
.
format
(
_
_
(
'Applied category'
),
apply_category_display
,
_
_
(
'Applied type'
),
apply_type_display
,
_
_
(
'Applied application group'
),
apply_application_group
,
_
_
(
'Applied system user group'
),
apply_system_user_group
,
_
_
(
'Applied date start'
),
apply_date_start
,
_
_
(
'Applied date expired'
),
apply_date_expired
,
_
(
'Applied category'
),
apply_category_display
,
_
(
'Applied type'
),
apply_type_display
,
_
(
'Applied application group'
),
apply_application_group
,
_
(
'Applied system user group'
),
apply_system_user_group
,
_
(
'Applied date start'
),
apply_date_start
,
_
(
'Applied date expired'
),
apply_date_expired
,
)
return
applied_body
...
...
@@ -72,10 +72,10 @@ class Handler(BaseHandler):
{}: {},
{}: {},
'''
.
format
(
_
_
(
'Approved applications'
),
approve_applications_display
,
_
_
(
'Approved system users'
),
approve_system_users_display
,
_
_
(
'Approved date start'
),
approve_date_start
,
_
_
(
'Approved date expired'
),
approve_date_expired
_
(
'Approved applications'
),
approve_applications_display
,
_
(
'Approved system users'
),
approve_system_users_display
,
_
(
'Approved date start'
),
approve_date_start
,
_
(
'Approved date expired'
),
approve_date_expired
)
return
approved_body
...
...
@@ -92,10 +92,10 @@ class Handler(BaseHandler):
approve_system_users_id
=
self
.
ticket
.
meta
.
get
(
'approve_system_users'
,
[])
approve_date_start
=
self
.
ticket
.
meta
.
get
(
'approve_date_start'
)
approve_date_expired
=
self
.
ticket
.
meta
.
get
(
'approve_date_expired'
)
permission_name
=
'{}
({})'
.
format
(
__
(
'Created by ticket ({})'
.
format
(
self
.
ticket
.
title
)),
str
(
self
.
ticket
.
id
)[:
4
]
permission_name
=
_
(
'Created by ticket ({})
({})'
.
format
(
self
.
ticket
.
title
,
str
(
self
.
ticket
.
id
)[:
4
])
)
permission_comment
=
_
_
(
permission_comment
=
_
(
'Created by the ticket, '
'ticket title: {}, '
'ticket applicant: {}, '
...
...
@@ -108,10 +108,10 @@ class Handler(BaseHandler):
)
permissions_data
=
{
'id'
:
self
.
ticket
.
id
,
'name'
:
permission_name
,
'name'
:
str
(
permission_name
)
,
'category'
:
apply_category
,
'type'
:
apply_type
,
'comment'
:
permission_comment
,
'comment'
:
str
(
permission_comment
)
,
'created_by'
:
'{}:{}'
.
format
(
str
(
self
.
__class__
.
__name__
),
str
(
self
.
ticket
.
id
)),
'date_start'
:
approve_date_start
,
'date_expired'
:
approve_date_expired
,
...
...
apps/tickets/handler/apply_asset.py
浏览文件 @
243eedc4
from
.base
import
BaseHandler
from
django.utils.translation
import
ugettext
as
_
_
from
django.utils.translation
import
ugettext
as
_
from
perms.models
import
AssetPermission
,
Action
from
assets.models
import
Asset
,
SystemUser
...
...
@@ -54,12 +54,12 @@ class Handler(BaseHandler):
{}: {},
{}: {}
'''
.
format
(
_
_
(
'Applied IP group'
),
apply_ip_group
,
_
_
(
"Applied hostname group"
),
apply_hostname_group
,
_
_
(
"Applied system user group"
),
apply_system_user_group
,
_
_
(
"Applied actions"
),
apply_actions_display
,
_
_
(
'Applied date start'
),
apply_date_start
,
_
_
(
'Applied date expired'
),
apply_date_expired
,
_
(
'Applied IP group'
),
apply_ip_group
,
_
(
"Applied hostname group"
),
apply_hostname_group
,
_
(
"Applied system user group"
),
apply_system_user_group
,
_
(
"Applied actions"
),
apply_actions_display
,
_
(
'Applied date start'
),
apply_date_start
,
_
(
'Applied date expired'
),
apply_date_expired
,
)
return
applied_body
...
...
@@ -75,11 +75,11 @@ class Handler(BaseHandler):
{}: {},
{}: {}
'''
.
format
(
_
_
(
'Approved assets'
),
approve_assets_display
,
_
_
(
'Approved system users'
),
approve_system_users_display
,
_
_
(
'Approved actions'
),
', '
.
join
(
approve_actions_display
),
_
_
(
'Approved date start'
),
approve_date_start
,
_
_
(
'Approved date expired'
),
approve_date_expired
,
_
(
'Approved assets'
),
approve_assets_display
,
_
(
'Approved system users'
),
approve_system_users_display
,
_
(
'Approved actions'
),
', '
.
join
(
approve_actions_display
),
_
(
'Approved date start'
),
approve_date_start
,
_
(
'Approved date expired'
),
approve_date_expired
,
)
return
approved_body
...
...
@@ -95,23 +95,25 @@ class Handler(BaseHandler):
approve_actions
=
self
.
ticket
.
meta
.
get
(
'approve_actions'
,
Action
.
NONE
)
approve_date_start
=
self
.
ticket
.
meta
.
get
(
'approve_date_start'
)
approve_date_expired
=
self
.
ticket
.
meta
.
get
(
'approve_date_expired'
)
permission_name
=
'{}
({})'
.
format
(
__
(
'Created by ticket ({})'
.
format
(
self
.
ticket
.
title
)),
str
(
self
.
ticket
.
id
)[:
4
]
permission_name
=
_
(
'Created by ticket ({})
({})'
.
format
(
self
.
ticket
.
title
,
str
(
self
.
ticket
.
id
)[:
4
])
)
permission_comment
=
_
_
(
permission_comment
=
_
(
'Created by the ticket, '
'ticket title: {}, '
'ticket applicant: {}, '
'ticket processor: {}, '
'ticket ID: {}'
''
.
format
(
self
.
ticket
.
title
,
self
.
ticket
.
applicant_display
,
self
.
ticket
.
processor_display
,
self
.
ticket
.
title
,
self
.
ticket
.
applicant_display
,
self
.
ticket
.
processor_display
,
str
(
self
.
ticket
.
id
)
)
)
permission_data
=
{
'id'
:
self
.
ticket
.
id
,
'name'
:
permission_name
,
'name'
:
str
(
permission_name
)
,
'comment'
:
permission_comment
,
'created_by'
:
'{}:{}'
.
format
(
str
(
self
.
__class__
.
__name__
),
str
(
self
.
ticket
.
id
)),
'actions'
:
approve_actions
,
...
...
apps/tickets/handler/base.py
浏览文件 @
243eedc4
from
django.utils.translation
import
ugettext
as
_
_
from
django.utils.translation
import
ugettext
as
_
from
common.utils
import
get_logger
from
tickets.utils
import
send_ticket_processed_mail_to_applicant
from
tickets.utils
import
(
send_ticket_processed_mail_to_applicant
,
send_ticket_applied_mail_to_assignees
)
logger
=
get_logger
(
__name__
)
...
...
@@ -14,9 +16,11 @@ class BaseHandler(object):
# on action
def
_on_open
(
self
):
self
.
ticket
.
applicant_display
=
str
(
self
.
ticket
.
applicant
)
self
.
ticket
.
assignees_display
=
[
str
(
assignee
)
for
assignee
in
self
.
ticket
.
assignees
.
all
()]
meta_display
=
getattr
(
self
,
'_construct_meta_display_of_open'
,
lambda
:
{})()
self
.
ticket
.
meta
.
update
(
meta_display
)
self
.
ticket
.
save
()
self
.
_send_applied_mail_to_assignees
()
def
_on_approve
(
self
):
meta_display
=
getattr
(
self
,
'_construct_meta_display_of_approve'
,
lambda
:
{})()
...
...
@@ -41,11 +45,12 @@ class BaseHandler(object):
return
method
()
# email
def
_send_applied_mail_to_assignees
(
self
):
logger
.
debug
(
'Send applied email to assignees: {}'
.
format
(
self
.
ticket
.
assignees_display
))
send_ticket_applied_mail_to_assignees
(
self
.
ticket
)
def
_send_processed_mail_to_applicant
(
self
):
msg
=
'Ticket ({}) has processed, send mail to applicant ({})'
.
format
(
self
.
ticket
.
title
,
self
.
ticket
.
applicant_display
)
logger
.
debug
(
msg
)
logger
.
debug
(
'Send processed mail to applicant: {}'
.
format
(
self
.
ticket
.
applicant_display
))
send_ticket_processed_mail_to_applicant
(
self
.
ticket
)
# comments
...
...
@@ -54,13 +59,18 @@ class BaseHandler(object):
user_display
=
str
(
user
)
action_display
=
self
.
ticket
.
get_action_display
()
data
=
{
'body'
:
_
_
(
'User {} {} the ticket'
.
format
(
user_display
,
action_display
)),
'body'
:
_
(
'User {} {} the ticket'
.
format
(
user_display
,
action_display
)),
'user'
:
user
,
'user_display'
:
user_display
}
return
self
.
ticket
.
comments
.
create
(
**
data
)
# body
body_html_format
=
'''
{}:
<div style="margin-left: 20px;">{}</div>
'''
def
get_body
(
self
):
old_body
=
self
.
ticket
.
meta
.
get
(
'body'
)
if
old_body
:
...
...
@@ -71,9 +81,7 @@ class BaseHandler(object):
return
basic_body
+
meta_body
def
_construct_basic_body
(
self
):
body
=
'''
{}:
{}: {},
basic_body
=
'''{}: {},
{}: {},
{}: {},
{}: {},
...
...
@@ -81,15 +89,15 @@ class BaseHandler(object):
{}: {},
{}: {}
'''
.
format
(
__
(
"Ticket basic info"
),
__
(
'Ticket title'
),
self
.
ticket
.
title
,
__
(
'Ticket type'
),
self
.
ticket
.
get_type_display
(),
__
(
'Ticket applicant'
),
self
.
ticket
.
applicant_display
,
__
(
'Ticket assignees'
),
self
.
ticket
.
assignees_display
,
__
(
'Ticket processor'
),
self
.
ticket
.
processor_display
,
__
(
'Ticket action'
),
self
.
ticket
.
get_action_display
(),
__
(
'Ticket status'
),
self
.
ticket
.
get_status_display
()
_
(
'Ticket title'
),
self
.
ticket
.
title
,
_
(
'Ticket type'
),
self
.
ticket
.
get_type_display
(),
_
(
'Ticket applicant'
),
self
.
ticket
.
applicant_display
,
_
(
'Ticket assignees'
),
self
.
ticket
.
assignees_display
,
_
(
'Ticket processor'
),
self
.
ticket
.
processor_display
or
_
(
'No'
),
_
(
'Ticket action'
),
self
.
ticket
.
get_action_display
(),
_
(
'Ticket status'
),
self
.
ticket
.
get_status_display
()
)
body
=
self
.
body_html_format
.
format
(
_
(
"Ticket basic info"
),
basic_body
)
return
body
def
_construct_meta_body
(
self
):
...
...
@@ -102,21 +110,11 @@ class BaseHandler(object):
return
body
def
_base_construct_meta_body_of_open
(
self
):
open_body
=
'''
{}:
{}
'''
.
format
(
__
(
'Ticket applied info'
),
getattr
(
self
,
'_construct_meta_body_of_open'
,
lambda
:
'No'
)()
)
return
open_body
meta_body_of_open
=
getattr
(
self
,
'_construct_meta_body_of_open'
,
lambda
:
'No'
)()
body
=
self
.
body_html_format
.
format
(
_
(
'Ticket applied info'
),
meta_body_of_open
)
return
body
def
_base_construct_meta_body_of_approve
(
self
):
approve_body
=
'''
{}:
{}
'''
.
format
(
__
(
'Ticket approved info'
),
getattr
(
self
,
'_construct_meta_body_of_approve'
,
lambda
:
'No'
)()
)
return
approve_body
meta_body_of_approve
=
getattr
(
self
,
'_construct_meta_body_of_approve'
,
lambda
:
'No'
)()
body
=
self
.
body_html_format
.
format
(
_
(
'Ticket approved info'
),
meta_body_of_approve
)
return
body
apps/tickets/handler/login_confirm.py
浏览文件 @
243eedc4
from
django.utils.translation
import
ugettext
as
_
_
from
django.utils.translation
import
ugettext
as
_
from
.base
import
BaseHandler
...
...
@@ -13,8 +13,8 @@ class Handler(BaseHandler):
{}: {},
{}: {}
'''
.
format
(
_
_
(
"Applied login IP"
),
apply_login_ip
,
_
_
(
"Applied login city"
),
apply_login_city
,
_
_
(
"Applied login datetime"
),
apply_login_datetime
,
_
(
"Applied login IP"
),
apply_login_ip
,
_
(
"Applied login city"
),
apply_login_city
,
_
(
"Applied login datetime"
),
apply_login_datetime
,
)
return
applied_body
apps/tickets/signals_handler/ticket.py
浏览文件 @
243eedc4
# -*- coding: utf-8 -*-
#
from
django.dispatch
import
receiver
from
django.db.models.signals
import
m2m_changed
from
common.utils
import
get_logger
from
tickets.models
import
Ticket
from
tickets.utils
import
send_ticket_applied_mail_to_assignees
from
..signals
import
post_change_ticket_action
...
...
@@ -15,19 +13,3 @@ logger = get_logger(__name__)
@
receiver
(
post_change_ticket_action
,
sender
=
Ticket
)
def
on_post_change_ticket_action
(
sender
,
ticket
,
action
,
**
kwargs
):
ticket
.
handler
.
dispatch
(
action
)
@
receiver
(
m2m_changed
,
sender
=
Ticket
.
assignees
.
through
)
def
on_ticket_assignees_changed
(
sender
,
instance
,
action
,
reverse
,
model
,
pk_set
,
**
kwargs
):
if
reverse
:
return
if
action
!=
'post_add'
:
return
logger
.
debug
(
'Receives ticket and assignees changed signal, ticket: {}'
.
format
(
instance
.
title
))
instance
.
assignees_display
=
[
str
(
assignee
)
for
assignee
in
instance
.
assignees
.
all
()]
instance
.
save
()
assignees
=
model
.
objects
.
filter
(
pk__in
=
pk_set
)
assignees_display
=
[
str
(
assignee
)
for
assignee
in
assignees
]
logger
.
debug
(
'Send applied email to assignees: {}'
.
format
(
assignees_display
))
send_ticket_applied_mail_to_assignees
(
instance
,
assignees
)
apps/tickets/utils.py
浏览文件 @
243eedc4
...
...
@@ -11,10 +11,10 @@ from . import const
logger
=
get_logger
(
__file__
)
def
send_ticket_applied_mail_to_assignees
(
ticket
,
assignees
):
if
not
assignees
:
def
send_ticket_applied_mail_to_assignees
(
ticket
):
if
not
ticket
.
assignees
:
logger
.
debug
(
"Not found assignees, ticket: {}({}), assignees: {}"
.
format
(
ticket
,
str
(
ticket
.
id
),
assignees
)
ticket
,
str
(
ticket
.
id
),
ticket
.
assignees
)
)
return
...
...
@@ -22,25 +22,22 @@ def send_ticket_applied_mail_to_assignees(ticket, assignees):
ticket_detail_url
=
urljoin
(
settings
.
SITE_URL
,
const
.
TICKET_DETAIL_URL
.
format
(
id
=
str
(
ticket
.
id
))
)
message
=
_
(
"""
<div>
<p>
Your has a new ticket
</p>
message
=
"""
<div>
<p>
{title} <a href={ticket_detail_url}>{ticket_detail_url_description}</a>
</p>
<div>
<b>Ticket:</b>
<br/>
{body}
<br/>
<a href={ticket_detail_url}>click here to review</a>
{body}
</div>
</div>
"""
.
format
(
title
=
_
(
'Your has a new ticket, from applicant - {}'
).
format
(
str
(
ticket
.
applicant
)),
ticket_detail_url
=
ticket_detail_url
,
ticket_detail_url_description
=
_
(
'click here to review'
),
body
=
ticket
.
body
.
replace
(
'
\n
'
,
'<br/>'
),
ticket_detail_url
=
ticket_detail_url
)
)
if
settings
.
DEBUG
:
logger
.
debug
(
message
)
recipient_list
=
[
assignee
.
email
for
assignee
in
assignees
]
recipient_list
=
[
assignee
.
email
for
assignee
in
ticket
.
assignees
.
all
()
]
send_mail_async
.
delay
(
subject
,
message
,
recipient_list
,
html_message
=
message
)
...
...
@@ -48,22 +45,18 @@ def send_ticket_processed_mail_to_applicant(ticket):
if
not
ticket
.
applicant
:
logger
.
error
(
"Not found applicant: {}({})"
.
format
(
ticket
.
title
,
ticket
.
id
))
return
subject
=
_
(
'Ticket has processed: {} ({})'
).
format
(
ticket
.
title
,
ticket
.
get_type_display
())
message
=
_
(
"""
subject
=
_
(
'Ticket has processed: {} ({})'
).
format
(
ticket
.
title
,
ticket
.
processor_display
)
message
=
"""
<div>
<p>
Your ticket has been processed
</p>
<p>
{title}
</p>
<div>
<b>Ticket:</b>
<br/>
{body}
<br/>
{body}
</div>
</div>
"""
.
format
(
title
=
_
(
'Your ticket has been ({}) processed'
).
format
(
ticket
.
processor_display
),
body
=
ticket
.
body
.
replace
(
'
\n
'
,
'<br/>'
),
)
)
if
settings
.
DEBUG
:
logger
.
debug
(
message
)
recipient_list
=
[
ticket
.
applicant
.
email
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录