Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/2.8' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek committed Jan 8, 2025
2 parents faa2c07 + ee37c70 commit c913f79
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8']
python-version: ['3.10']
node-version: ['14']
e2e: ['a', 'b']
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.10']
env:
INSTALL_PY_MODULES: true
RUN_SERVICES: true
Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.10']
env:
INSTALL_PY_MODULES: true
RUN_SERVICES: true
Expand All @@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.10']
env:
INSTALL_PY_MODULES: true
INSTALL_PY_EDITABLE: true
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superdesk-planning",
"version": "2.8.3",
"version": "2.8.4",
"license": "AGPL-3.0",
"description": "",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion server/planning/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
from planning.planning_locks import init_app as init_planning_locks_app
from planning.search.planning_autocomplete import init_app as init_planning_autocomplete_app

__version__ = "2.8.3"
__version__ = "2.8.4"

_SERVER_PATH = os.path.dirname(os.path.realpath(__file__))

Expand Down
8 changes: 7 additions & 1 deletion server/planning/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,13 @@ def is_event_updated(new_item: Event, old_item: Event) -> bool:
return True
new_subject = set([get_subject_str(subject) for subject in new_item.get("subject", [])])
old_subject = set([get_subject_str(subject) for subject in old_item.get("subject", [])])
return new_subject != old_subject
if new_subject != old_subject:
return True
old_location = old_item.get("location", [])
new_location = new_item.get("location", [])
if new_location != old_location:
return True
return False


class EventsService(superdesk.Service):
Expand Down
17 changes: 16 additions & 1 deletion server/planning/events/events_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,20 @@
"accreditation_deadline": {"type": "datetime"},
# Reference can be used to hold for example a court case reference number
"reference": {"type": "string"},
"anpa_category": metadata_schema["anpa_category"],
"anpa_category": {
"type": "list",
"nullable": True,
"mapping": {
"type": "object",
"dynamic": False,
"properties": {
"qcode": not_analyzed,
"name": not_analyzed,
"scheme": not_analyzed,
"translations": {"enabled": False}, # explicitly disable
},
},
},
"files": {
"type": "list",
"nullable": True,
Expand Down Expand Up @@ -209,6 +222,7 @@
"address": {"type": "object", "dynamic": True},
"geo": {"type": "string"},
"location": {"type": "geo_point"},
"translations": {"enabled": False}, # explicitly disable
},
},
"nullable": True,
Expand Down Expand Up @@ -268,6 +282,7 @@
"properties": {
"qcode": not_analyzed,
"name": not_analyzed,
"translations": {"enabled": False}, # explicitly disable
},
},
},
Expand Down
12 changes: 11 additions & 1 deletion server/planning/events/events_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime, timedelta
import pytz

from datetime import datetime, timedelta
from copy import deepcopy
from mock import Mock, patch
from superdesk import get_resource_service
Expand All @@ -10,6 +11,8 @@
from planning.events.events import generate_recurring_dates
from werkzeug.exceptions import BadRequest

from .events import is_event_updated


class EventTestCase(TestCase):
def test_recurring_dates_generation(self):
Expand Down Expand Up @@ -698,3 +701,10 @@ def test_related_planning_item_fields_validation_on_post(self):
planning_item = planning_service.find_one(req=None, _id=planning_id[0])
self.assertEqual(len([planning_item]), 1)
self.assertEqual(planning_item.get("state"), "scheduled")


def test_is_event_updated():
new_event = {"location": [{"name": "test"}]}
old_events = {"location": [{"name": "test", "state": "bar"}]}
assert is_event_updated(new_event, old_events)
assert not is_event_updated(new_event, new_event)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="superdesk-planning",
version="2.8.3",
version="2.8.4",
description=DESCRIPTION,
long_description=DESCRIPTION,
package_dir={"": "server"},
Expand Down

0 comments on commit c913f79

Please sign in to comment.