feat(components): Auto submit public records to cern research#837
feat(components): Auto submit public records to cern research#837sakshamarora1 wants to merge 1 commit into
Conversation
dae678a to
f7663b6
Compare
| return False | ||
|
|
||
| resource_type = draft["metadata"]["resource_type"]["id"] | ||
| public_research_types = current_app.config.get( |
There was a problem hiding this comment.
| public_research_types = current_app.config.get( | |
| research_types = current_app.config.get( |
this is a bit confusing as a variable name. Do we have anything like public research types? did you mean research resource types?
|
|
||
| csc_community_id = current_app.config.get("CDS_CERN_SCIENTIFIC_COMMUNITY_ID") | ||
| if not csc_community_id: | ||
| current_app.logger.warning( |
There was a problem hiding this comment.
this should be an error not a warning and we want this popping up sentry as an exception, this variable is very important and if it is not configured, we should know
There was a problem hiding this comment.
Alright, updated!
|
|
||
| return True | ||
|
|
||
| def publish(self, identity, draft=None, record=None, **kwargs): |
There was a problem hiding this comment.
do we auto accept it? or it needs to be accepted?
There was a problem hiding this comment.
In the task, there is "require_review": True
It only submits for review
| """Create and submit a community inclusion request to the CERN Scientific Community after a public record satisfies the criteria.""" | ||
| csc_community_id = current_app.config.get("CDS_CERN_SCIENTIFIC_COMMUNITY_ID") | ||
| if not csc_community_id: | ||
| current_app.logger.warning( |
There was a problem hiding this comment.
same as above, also since the task is checking it here, do we need to do the same in the component? isn't it redundant in the component?
| "require_review": True, | ||
| "comment": { | ||
| "payload": { | ||
| "content": "<p>This record was automatically submitted to the CERN Research Community because it satisfies the criteria for inclusion.</p>", |
There was a problem hiding this comment.
| "content": "<p>This record was automatically submitted to the CERN Research Community because it satisfies the criteria for inclusion.</p>", | |
| "content": "<p>This record was automatically submitted to the CERN Research Community by the system because it satisfies the criteria for inclusion (resource type identified as research related) </p>", |
|
|
||
| try: | ||
| with UnitOfWork() as uow: | ||
| processed, errors = current_record_communities_service.add( |
There was a problem hiding this comment.
doesn't it automatically add the community to the record without requiring the review? We discussed that initially we should go through approval, we might switch to automatic approval later on
There was a problem hiding this comment.
If that happens, later on we can remove the require_review flag from the data being passed to this service method.
7131a57 to
28ec1dc
Compare
28ec1dc to
a69b2e5
Compare
closes: #830