Skip to content

Commit

Permalink
Merge pull request #58 from oarepo/optional-workflow
Browse files Browse the repository at this point in the history
Making workflows optional again
  • Loading branch information
mesemus authored Sep 22, 2024
2 parents dc0acc2 + d88f20f commit 78694e4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
27 changes: 15 additions & 12 deletions oarepo_requests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
import oarepo_workflows # noqa

from oarepo_requests.actions.components import WorkflowTransitionComponent
from oarepo_workflows.requests.events import WorkflowEvent

workflow_action_components = [WorkflowTransitionComponent]
except ImportError:
workflow_action_components = []
WorkflowEvent = None

from oarepo_requests.resolvers.ui import (
FallbackEntityReferenceUIResolver,
GroupEntityReferenceUIResolver,
Expand All @@ -26,7 +29,6 @@
from invenio_requests.services.permissions import (
PermissionPolicy as InvenioRequestsPermissionPolicy,
)
from oarepo_workflows.requests.events import WorkflowEvent


REQUESTS_REGISTERED_TYPES = [
Expand All @@ -41,17 +43,18 @@

REQUESTS_ALLOWED_RECEIVERS = ["user", "group", "auto_approve"]

DEFAULT_WORKFLOW_EVENT_SUBMITTERS = {
CommentEventType.type_id: WorkflowEvent(
submitters=InvenioRequestsPermissionPolicy.can_create_comment
),
LogEventType.type_id: WorkflowEvent(
submitters=InvenioRequestsPermissionPolicy.can_create_comment
),
TopicUpdateEventType.type_id: WorkflowEvent(
submitters=InvenioRequestsPermissionPolicy.can_create_comment
),
}
if WorkflowEvent:
DEFAULT_WORKFLOW_EVENT_SUBMITTERS = {
CommentEventType.type_id: WorkflowEvent(
submitters=InvenioRequestsPermissionPolicy.can_create_comment
),
LogEventType.type_id: WorkflowEvent(
submitters=InvenioRequestsPermissionPolicy.can_create_comment
),
TopicUpdateEventType.type_id: WorkflowEvent(
submitters=InvenioRequestsPermissionPolicy.can_create_comment
),
}

ENTITY_REFERENCE_UI_RESOLVERS = {
"user": UserEntityReferenceUIResolver("user"),
Expand Down
7 changes: 7 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ pip install "oarepo[tests]==$OAREPO_VERSION.*"
pip install -e "./$BUILD_TEST_DIR/${MODEL}"
pip install oarepo-ui
pip install deepdiff

# Check if we can import all the sources
find oarepo_requests -name '*.py' | grep -v '__init__.py' | sed 's/.py$//' | tr '/' '.' | sort -u | while read MODULE ; do
echo "import $MODULE"
done | python

# now install the tests (might bring more dependencies, that's why we have checked the imports before)
pip install -e ".[tests]"

sh forked_install.sh invenio-records-resources
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = oarepo-requests
version = 2.1.0
version = 2.1.1
description =
authors = Ronald Krist <[email protected]>
readme = README.md
Expand Down

0 comments on commit 78694e4

Please sign in to comment.