Skip to content

Commit

Permalink
change topic method
Browse files Browse the repository at this point in the history
  • Loading branch information
Alzbeta Pokorna committed Jan 2, 2025
1 parent aa3d5a9 commit e932392
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions oarepo_doi/types/doi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from typing_extensions import override
from oarepo_requests.utils import is_auto_approved, request_identity_matches
from ..actions.doi import CreateDoiAction, ValidateDataForDoiAction


from invenio_requests.records.api import Request
from invenio_records_resources.services.uow import RecordCommitOp, UnitOfWork
from invenio_requests.proxies import current_requests_service
class AssignDoiRequestType(NonDuplicableOARepoRequestType):
type_id = "assign_doi"
name = _("Assign Doi")
Expand Down Expand Up @@ -45,6 +46,12 @@ def is_applicable_to(self, identity, topic, *args, **kwargs):
else:
return super().is_applicable_to(identity, topic, *args, **kwargs)


def topic_change(self, request: Request, new_topic: dict, uow: UnitOfWork) -> None:
"""Change the topic of the request."""
request.topic = new_topic
uow.register(RecordCommitOp(request, indexer=current_requests_service.indexer))

@override
def stateful_name(self, identity, *, topic, request=None, **kwargs):
if is_auto_approved(self, identity=identity, topic=topic):
Expand Down

0 comments on commit e932392

Please sign in to comment.