chg: [mail exporter] add object url only if email is ail user
Some checks are pending
CI / ail_test (3.10) (push) Waiting to run
CI / ail_test (3.7) (push) Waiting to run
CI / ail_test (3.8) (push) Waiting to run
CI / ail_test (3.9) (push) Waiting to run

This commit is contained in:
terrtia 2025-01-29 10:46:43 +01:00
parent 9802b04fa6
commit d53328b55b
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -26,6 +26,7 @@ sys.path.append(os.environ['AIL_BIN'])
# Import Project packages # Import Project packages
################################## ##################################
from lib import ail_logger from lib import ail_logger
from lib import ail_users
from exporter.abstract_exporter import AbstractExporter from exporter.abstract_exporter import AbstractExporter
from lib.ConfigLoader import ConfigLoader from lib.ConfigLoader import ConfigLoader
# from lib.objects.abstract_object import AbstractObject # from lib.objects.abstract_object import AbstractObject
@ -133,7 +134,7 @@ class MailExporterTracker(MailExporter):
subject = f'AIL Framework Tracker: {description}' subject = f'AIL Framework Tracker: {description}'
body = f"AIL Framework, New occurrence for {tracker_type} tracker: {tracker_name}\n" body = f"AIL Framework, New occurrence for {tracker_type} tracker: {tracker_name}\n"
body += f'Item: {obj.id}\nurl:{obj.get_link()}' body += f'Object {obj.type}: {obj.id}\n'
if matches: if matches:
body += '\n' body += '\n'
@ -141,10 +142,9 @@ class MailExporterTracker(MailExporter):
for match in matches: for match in matches:
body += f'\nMatch {nb}: {match[0]}\nExtract:\n{match[1]}\n\n' body += f'\nMatch {nb}: {match[0]}\nExtract:\n{match[1]}\n\n'
nb += 1 nb += 1
else:
body = f"AIL Framework, New occurrence for {tracker_type} tracker: {tracker_name}\n"
body += f'Item: {obj.id}\nurl:{obj.get_link()}'
# print(body) ail_link = f'AIL url:{obj.get_link()}/n/n'
for mail in tracker.get_mails(): for mail in tracker.get_mails():
if ail_users.exists_user(mail):
body = ail_link + body
self._export(mail, subject, body) self._export(mail, subject, body)