mirror of https://github.com/jumpserver/jumpserver
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
from django.conf import settings
|
|
|
|
from common.utils import get_logger
|
|
from .notifications import TicketAppliedToAssignee, TicketProcessedToApplicant
|
|
|
|
logger = get_logger(__file__)
|
|
|
|
|
|
def send_ticket_applied_mail_to_assignees(ticket):
|
|
assignees = ticket.current_node.first().ticket_assignees.all()
|
|
if not assignees:
|
|
logger.debug("Not found assignees, ticket: {}({}), assignees: {}".format(ticket, str(ticket.id), assignees))
|
|
return
|
|
|
|
for assignee in assignees:
|
|
instance = TicketAppliedToAssignee(assignee, ticket)
|
|
if settings.DEBUG:
|
|
logger.debug(instance)
|
|
instance.publish_async()
|
|
|
|
|
|
def send_ticket_processed_mail_to_applicant(ticket, processor):
|
|
if not ticket.applicant:
|
|
logger.error("Not found applicant: {}({})".format(ticket.title, ticket.id))
|
|
return
|
|
|
|
instance = TicketProcessedToApplicant(ticket.applicant, ticket, processor)
|
|
if settings.DEBUG:
|
|
logger.debug(instance)
|
|
instance.publish_async()
|