Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: allow comment notification builder to be custom #418

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions invenio_requests/customizations/request_types.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -130,6 +131,8 @@ class RequestType:
}
"""

comment_notification_builder = CommentRequestEventCreateNotificationBuilder

needs_context = None
"""The context for needs.

Expand Down
13 changes: 3 additions & 10 deletions invenio_requests/services/events/service.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down Expand Up @@ -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)
slint marked this conversation as resolved.
Show resolved Hide resolved
)
)

Expand Down
Loading