diff --git a/invenio_requests/customizations/request_types.py b/invenio_requests/customizations/request_types.py index 5c840509..fb0bee0b 100644 --- a/invenio_requests/customizations/request_types.py +++ b/invenio_requests/customizations/request_types.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2021 - 2022 TU Wien. -# Copyright (C) 2021 CERN. +# Copyright (C) 2021-2022 TU Wien. +# Copyright (C) 2021-2024 CERN. # # Invenio-Requests is free software; you can redistribute it and/or modify # it under the terms of the MIT License; see LICENSE file for more details. @@ -18,6 +18,7 @@ import marshmallow as ma from invenio_records_resources.services.references import EntityReferenceBaseSchema +from ..notifications.builders import CommentRequestEventCreateNotificationBuilder from ..proxies import current_requests from .actions import ( AcceptAction, @@ -130,6 +131,8 @@ class RequestType: } """ + comment_notification_builder = CommentRequestEventCreateNotificationBuilder + needs_context = None """The context for needs. diff --git a/invenio_requests/services/events/service.py b/invenio_requests/services/events/service.py index d97fe60c..d2da6ecf 100644 --- a/invenio_requests/services/events/service.py +++ b/invenio_requests/services/events/service.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2021-2022 CERN. +# Copyright (C) 2021-2024 CERN. # Copyright (C) 2021-2022 Northwestern University. # Copyright (C) 2021-2022 TU Wien. # Copyright (C) 2023 Graz University of Technology. @@ -14,18 +14,11 @@ from invenio_notifications.services.uow import NotificationOp from invenio_records_resources.services import RecordService, ServiceSchemaWrapper from invenio_records_resources.services.base.links import LinksTemplate -from invenio_records_resources.services.uow import ( - RecordCommitOp, - RecordDeleteOp, - unit_of_work, -) +from invenio_records_resources.services.uow import RecordCommitOp, unit_of_work from invenio_search.engine import dsl from invenio_requests.customizations import CommentEventType from invenio_requests.customizations.event_types import LogEventType -from invenio_requests.notifications.builders import ( - CommentRequestEventCreateNotificationBuilder, -) from invenio_requests.records.api import RequestEventFormat from invenio_requests.services.results import EntityResolverExpandableField @@ -86,7 +79,7 @@ def create( if notify and event_type is CommentEventType: uow.register( NotificationOp( - CommentRequestEventCreateNotificationBuilder.build(request, event) + request.type.comment_notification_builder.build(request, event) ) )