From c2b592f6fedfe2190e61563342d01941b150499a Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Thu, 23 Feb 2023 10:46:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=9B=E5=BB=BA=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=92=8C=E9=AA=8C=E8=AF=81=E8=B4=A6=E5=8F=B7=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=9A=84Activity=E6=97=A5=E5=BF=97=E4=BF=9D=E5=AD=98=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/accounts/tasks/verify_account.py | 2 +- apps/audits/signal_handlers/activity_log.py | 4 ++-- apps/common/tasks.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/accounts/tasks/verify_account.py b/apps/accounts/tasks/verify_account.py index efc6bb09d..5f221fcd6 100644 --- a/apps/accounts/tasks/verify_account.py +++ b/apps/accounts/tasks/verify_account.py @@ -47,7 +47,7 @@ def verify_accounts_connectivity_util(accounts, task_name): @shared_task( queue="ansible", verbose_name=_('Verify asset account availability'), - activity_callback=lambda self, account_ids, asset_ids: (account_ids, None) + activity_callback=lambda self, account_ids, *args, **kwargs: (account_ids, None) ) def verify_accounts_connectivity_task(account_ids): from accounts.models import Account, VerifyAccountAutomation diff --git a/apps/audits/signal_handlers/activity_log.py b/apps/audits/signal_handlers/activity_log.py index 430b25002..4b41d2d1d 100644 --- a/apps/audits/signal_handlers/activity_log.py +++ b/apps/audits/signal_handlers/activity_log.py @@ -57,8 +57,8 @@ class ActivityLogHandler: resource_ids, org_id, user = data + ('',) * (3 - len(data)) if not user: user = str(current_request.user) if current_request else 'System' - if org_id is None: - org_id = current_org.org_id + if not org_id: + org_id = current_org.id task_display = getattr(task, 'verbose_name', _('Unknown')) detail = i18n_fmt( gettext_noop('User %s perform a task for this resource: %s'), diff --git a/apps/common/tasks.py b/apps/common/tasks.py index 76616803a..b4c3d3488 100644 --- a/apps/common/tasks.py +++ b/apps/common/tasks.py @@ -10,11 +10,11 @@ from .utils import get_logger logger = get_logger(__file__) -def task_activity_callback(self, subject, message, from_email, recipient_list, **kwargs): +def task_activity_callback(self, subject, message, recipient_list, **kwargs): from users.models import User email_list = recipient_list resource_ids = list(User.objects.filter(email__in=email_list).values_list('id', flat=True)) - return resource_ids + return resource_ids, @shared_task(verbose_name=_("Send email"), activity_callback=task_activity_callback)