From ddacd5fce1fe9f84425a77686723d39c3cae1e66 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Wed, 17 Sep 2025 18:57:00 +0800 Subject: [PATCH] fix: Ticket direct approval --- apps/tickets/notifications.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/tickets/notifications.py b/apps/tickets/notifications.py index 51c8c75f9..182ae7828 100644 --- a/apps/tickets/notifications.py +++ b/apps/tickets/notifications.py @@ -12,7 +12,7 @@ from common.sdk.im.wecom import wecom_tool from common.utils import get_logger, random_string, reverse from notifications.notifications import UserMessage from . import const -from .models import Ticket +from .models import Ticket, ApplyAssetTicket logger = get_logger(__file__) @@ -125,6 +125,14 @@ class TicketAppliedToAssigneeMessage(BaseTicketMessage): return title def get_ticket_approval_url(self, external=True): + if isinstance(self.ticket, ApplyAssetTicket): + no_assets = not self.ticket.apply_assets.exists() + no_nodes = not self.ticket.apply_nodes.exists() + no_accounts = not self.ticket.apply_accounts + + if (no_assets and no_nodes) or no_accounts: + return None + url = reverse('tickets:direct-approve', kwargs={'token': self.token}) if not external: return url