Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/hotfix/2.6.8' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek committed Apr 11, 2024
2 parents 431ad96 + bd502b9 commit cc50c2c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions apps/archive/archive.py
Expand Up @@ -773,6 +773,7 @@ def remove_after_copy(self, copied_item, extra_fields=None, delete_keys=None):
"translation_id",
"translated_from",
"firstpublished",
"auto_publish",
]
)
if delete_keys:
Expand Down
13 changes: 13 additions & 0 deletions features/content_duplication.feature
Expand Up @@ -638,3 +638,16 @@ Feature: Duplication of Content
"""
When we get "/archive/#duplicate._id#"
Then we get "assignment_id" does not exist

@auth
Scenario: Auto publish flag is removed on duplication
When we patch given
"""
{"auto_publish": true}
"""
When we post to "/archive/123/duplicate" with success
"""
{"desk": "#desks._id#","type": "archive"}
"""
When we get "/archive/#duplicate._id#"
Then we get "auto_publish" does not exist
22 changes: 15 additions & 7 deletions superdesk/io/commands/update_ingest.py
Expand Up @@ -601,13 +601,7 @@ def ingest_item(item, provider, feeding_service, rule_set=None, routing_scheme=N
item.pop("profile")

set_default_state(item, CONTENT_STATE.INGESTED)
item["expiry"] = (
get_expiry_date(
provider.get("content_expiry") or app.config["INGEST_EXPIRY_MINUTES"], item.get("versioncreated")
)
if not expiry
else expiry
) # when fetching associated item set expiry to match parent
set_expiry(item, provider, parent_expiry=expiry)

if "anpa_category" in item:
process_anpa_category(item, provider)
Expand Down Expand Up @@ -763,4 +757,18 @@ def get_ingest_collection(feeding_service, item):
return ingest_collection


def set_expiry(item, provider, parent_expiry=None):
if parent_expiry:
item["expiry"] = parent_expiry
return

expiry_offset = item.get("versioncreated") or utcnow()
if item.get("dates") and item["dates"].get("end"):
expiry_offset = item["dates"]["end"]

item["expiry"] = get_expiry_date(
provider.get("content_expiry") or app.config["INGEST_EXPIRY_MINUTES"], expiry_offset
)


superdesk.command("ingest:update", UpdateIngest())

0 comments on commit cc50c2c

Please sign in to comment.