diff --git a/e2e/package.json b/e2e/package.json index 952cea03e..4652fb99b 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -17,7 +17,7 @@ }, "scripts": { "cypress-ui": "cypress open", - "cypress-ci": "cypress run", + "cypress-ci": "cypress run --browser chrome", "clean": "grunt clean", "build": "npx @superdesk/build-tools build-root-repo ./", "serve": "node --max-old-space-size=8192 ./node_modules/.bin/grunt server" diff --git a/server/features/events_postpone.feature b/server/features/events_postpone.feature index 43c9d9380..897e365b7 100644 --- a/server/features/events_postpone.feature +++ b/server/features/events_postpone.feature @@ -499,6 +499,7 @@ Feature: Events Postpone @auth @notification + @planning_cvs Scenario: Published event gets updated after postpone Given we have sessions "/sessions" Given "desks" diff --git a/server/features/planning_duplicate.feature b/server/features/planning_duplicate.feature index 8e8e67949..66f36e792 100644 --- a/server/features/planning_duplicate.feature +++ b/server/features/planning_duplicate.feature @@ -357,8 +357,7 @@ Feature: Duplicate Planning }, "assigned_to": { "desk": "#desks._id#", - "user": "#CONTEXT_USER_ID#", - "assignment_id": "aaaaaaaaaaaaaaaaaaaaaaaa" + "user": "#CONTEXT_USER_ID#" } }], "expired": true diff --git a/server/planning/planning/planning.py b/server/planning/planning/planning.py index 8315e98e6..109ecbc7a 100644 --- a/server/planning/planning/planning.py +++ b/server/planning/planning/planning.py @@ -65,7 +65,7 @@ from superdesk import Resource from lxml import etree from io import BytesIO -from planning.signals import planning_created +from planning.signals import planning_created, planning_ingested logger = logging.getLogger(__name__) @@ -85,6 +85,8 @@ def post_in_mongo(self, docs, **kwargs): resolve_document_etag(docs, self.datasource) ids = self.backend.create_in_mongo(self.datasource, docs, **kwargs) self.on_created(docs) + for doc in docs: + planning_ingested.send(self, item=doc) return ids def patch_in_mongo(self, id, document, original): @@ -93,6 +95,7 @@ def patch_in_mongo(self, id, document, original): update_ingest_on_patch(document, original) response = self.backend.update_in_mongo(self.datasource, id, document, original) self.on_updated(document, original, from_ingest=True) + planning_ingested.send(self, item=document, original=original) return response def is_new_version(self, new_item, old_item): @@ -523,13 +526,17 @@ def remove_coverage_entity(self, coverage_entity, original_planning, entity_type def add_coverages(self, updates, original): planning_date = original.get("planning_date") or updates.get("planning_date") + original_coverage_ids = [ + coverage["coverage_id"] for coverage in original.get("coverages") or [] if coverage.get("coverage_id") + ] for coverage in updates.get("coverages") or []: coverage_id = coverage.get("coverage_id", "") - if not coverage_id or TEMP_ID_PREFIX in coverage_id: + if not coverage_id or TEMP_ID_PREFIX in coverage_id or coverage_id not in original_coverage_ids: if "duplicate" in coverage_id: self.duplicate_xmp_file(coverage) # coverage to be created - coverage["coverage_id"] = generate_guid(type=GUID_NEWSML) + if not coverage_id or TEMP_ID_PREFIX in coverage_id: + coverage["coverage_id"] = generate_guid(type=GUID_NEWSML) coverage["firstcreated"] = utcnow() # Make sure the coverage has a ``scheduled`` date diff --git a/server/planning/signals.py b/server/planning/signals.py index 2a343d06f..3c7097ac4 100644 --- a/server/planning/signals.py +++ b/server/planning/signals.py @@ -12,8 +12,10 @@ __all__ = [ "planning_created", + "planning_ingested", ] signals = blinker.Namespace() planning_created = signals.signal("planning:created") +planning_ingested = signals.signal("planning:ingested")