Skip to content

Commit

Permalink
Merge pull request #1434 from MarkLark86/1.10
Browse files Browse the repository at this point in the history
Release 1.10.1-rc4
  • Loading branch information
MarkLark86 authored Feb 14, 2020
2 parents 1649f06 + 8dd21d2 commit 6c29726
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 28 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Superdesk Planning Changelog

## [1.10.1-rc3] Not Released Yet
## [1.10.1-rc4] Not Released Yet
### Features
- [SDESK-4767] Feature to attach files to coverages (#1403)
- [SDESK-4775] Attach .xmp file to picture assignments (#1405)
Expand All @@ -11,6 +11,7 @@
- [SDESK-4979] Add coverage provider and assigned user names to coverages on posting the planning item (#1424)
- [SDESK-5001] Coverage Icons for graphic, video_explainer and live_blog (#1428)
- [SDESK-4903] (1.10) Show FulfilAssignment challenge on archive send (#1425)
- [SDESK-5022] Remove whitespace from the beginning and end of the name and slugline when saving an Event or Planning item and Coverages (#1432)

### Fixes
- [SDESK-4889] Bug while removing an agenda (#1401)
Expand All @@ -32,6 +33,10 @@
- [SDESK-4980] Create two locations with same name (#1420)
- [SDESK-4888] Wrong coverage history on creation (#1427)
- [SDESK-5004] Turning on the 'NOT FOR PUBLICATION' toggle enables the 'SAVE & POST' button in the Planning editor (#1426)
- [SDESK-5019] FIX: Add scrolling for coverage types list in add coverage advance mode. (#1430)
- [SDESK-5025] Related planning item(s) not published when event is cancelled (#1431)
- [SDESK-5030] Scheduled Update not in delivery record (#1433)
- fix(behave): Add privilege error message in expected response (#1435)

## [1.10.0] 2019-12-12
### Features
Expand Down
2 changes: 1 addition & 1 deletion client/components/Coverages/CoverageAddAdvancedModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class CoverageAddAdvancedModal extends React.PureComponent {
<small>{gettext('(advanced mode)')}</small>
</h3>
</Modal.Header>
<Modal.Body noScroll>
<Modal.Body>
<div className="sd-list-item-group sd-list-item-group--space-between-items">
{this.state.coverages.map((coverage, index) => (
<div key={coverage.id} className="sd-list-item sd-shadow--z1">
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/support/common/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function waitForPageLoad() {
cy.log('UI.waitForPageLoad');
// Set the timeout waiting for this button to 60 seconds
// as this can sometimes take a while on initial load
cy.get('.icon-plus-large', {timeout: 60000});
cy.get('.icon-plus-large', {timeout: 180000});
}

export {ActionMenu} from './actionMenu';
Expand Down
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": "1.10.1-rc3",
"version": "1.10.1-rc4",
"license": "AGPL-3.0",
"description": "",
"main": "index.js",
Expand Down
4 changes: 2 additions & 2 deletions server/features/agenda.feature
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Feature: Agenda
"""
Then we get error 403
"""
{"_message": "", "_status": "ERR"}
{"_message": "Insufficient privileges for the requested operation.", "_status": "ERR"}
"""
When we patch "/users/#CONTEXT_USER_ID#"
"""
Expand Down Expand Up @@ -181,4 +181,4 @@ Feature: Agenda
"item": "#agenda._id#"
}
}]
"""
"""
6 changes: 5 additions & 1 deletion server/features/planning_duplicate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,8 @@ Feature: Duplicate Planning
"end": "2029-11-21T14:00:00.000Z",
"tz": "Australia/Sydney"
},
"state": "draft",
"state": "scheduled",
"pubstatus": "usable",
"lock_user": "#CONTEXT_USER_ID#",
"lock_session": "#SESSION_ID#",
"lock_action": "cancel",
Expand All @@ -649,6 +650,9 @@ Feature: Duplicate Planning
}]
"""
When we perform cancel on events "123"
"""
{"reason": "Cancelling the Event"}
"""
Then we get OK response
When we get "/events"
Then we get a list with 1 items
Expand Down
2 changes: 1 addition & 1 deletion server/planning/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import planning.output_formatters # noqa
from planning.planning_download import init_app as init_planning_download_app

__version__ = '1.10.1-rc3'
__version__ = '1.10.1-rc4'


def init_app(app):
Expand Down
5 changes: 4 additions & 1 deletion server/planning/assignments/assignments_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def link_archive_items_to_assignments(self, assignment, related_items, actioned_
# Update the delivery for the item if one exists
delivery = delivery_service.find_one(req=None, item_id=item[config.ID_FIELD])
if delivery:
delivery_service.patch(delivery['_id'], {'assignment_id': assignment['_id']})
delivery_service.patch(delivery['_id'], {
'assignment_id': assignment['_id'],
'scheduled_update_id': assignment.get('scheduled_update_id'),
})
else:
# Add a delivery for the item
deliveries.append({
Expand Down
9 changes: 9 additions & 0 deletions server/planning/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,12 @@ def get_coverage_for_assignment(assignment):
planning_item = get_resource_service('planning').find_one(req=None, _id=assignment.get('planning_item'))
return next((c for c in (planning_item or {}).get('coverages', [])
if c['coverage_id'] == assignment['coverage_item']), None)


def strip_text_fields(item, fields=['name', 'slugline']):
if not item:
return

for f in fields:
if item.get(f):
item[f] = item[f].strip()
3 changes: 2 additions & 1 deletion server/planning/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from planning.common import UPDATE_SINGLE, UPDATE_FUTURE, get_max_recurrent_events, \
WORKFLOW_STATE, ITEM_STATE, remove_lock_information, format_address, update_post_item, \
post_required, POST_STATE, get_event_max_multi_day_duration, set_original_creator, set_ingested_event_state, \
LOCK_ACTION
LOCK_ACTION, strip_text_fields
from .events_schema import events_schema

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -211,6 +211,7 @@ def validate_event(self, updates, original=None):
# Remove duplicated calendars
# uniq_qcodes = list_uniq_with_order([o['qcode'] for o in updates['calendars']])
# updates['calendars'] = [cal for cal in existing_calendars.get('items', []) if cal['qcode'] in uniq_qcodes]
strip_text_fields(updates)

def _validate_convert_to_recurring(self, updates, original):
"""Validates if the convert to recurring action is valid.
Expand Down
15 changes: 6 additions & 9 deletions server/planning/events/events_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from copy import deepcopy
from .events import EventsResource, events_schema
from .events_base_service import EventsBaseService
from flask import current_app as app
from flask import request
from superdesk.errors import SuperdeskApiError

event_cancel_schema = deepcopy(events_schema)
Expand Down Expand Up @@ -99,14 +99,11 @@ def _cancel_event_plannings(updates, original):
plans = list(planning_service.find(where={'event_item': original[config.ID_FIELD]}))
for plan in plans:
if plan.get('state') != WORKFLOW_STATE.CANCELLED:
updated_plan = planning_cancel_service.patch(
plan[config.ID_FIELD],
{'reason': reason, 'event_cancellation': True}
)
app.on_updated_planning_cancel(
updated_plan,
plan
)
request.view_args['event_cancellation'] = True
cancelled_plan = planning_cancel_service.patch(plan[config.ID_FIELD], {'reason': reason})

# Write history records
get_resource_service('planning_history').on_cancel(cancelled_plan, plan)

@staticmethod
def _set_event_cancelled(updates, original, occur_cancel_state):
Expand Down
7 changes: 6 additions & 1 deletion server/planning/planning/planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
remove_lock_information, WORKFLOW_STATE, ASSIGNMENT_WORKFLOW_STATE, update_post_item, get_coverage_type_name,\
set_original_creator, list_uniq_with_order, TEMP_ID_PREFIX, DEFAULT_ASSIGNMENT_PRIORITY,\
get_planning_allow_scheduled_updates, TO_BE_CONFIRMED_FIELD, TO_BE_CONFIRMED_FIELD_SCHEMA, \
get_planning_xmp_assignment_mapping
get_planning_xmp_assignment_mapping, strip_text_fields
from superdesk.utc import utcnow
from itertools import chain
from planning.planning_notifications import PlanningNotifications
Expand Down Expand Up @@ -211,6 +211,11 @@ def validate_planning(self, updates, original=None):
('planning_date' in updates and updates['planning_date'] is None):
raise SuperdeskApiError(message="Planning item should have a date")

strip_text_fields(updates)
if updates.get('coverages'):
for c in updates['coverages']:
strip_text_fields(c.get('planning') or {})

# Validate if agendas being added are enabled agendas
agenda_service = get_resource_service('agenda')
for agenda_id in updates.get('agendas', []):
Expand Down
13 changes: 6 additions & 7 deletions server/planning/planning/planning_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
from .planning import PlanningResource, planning_schema
from planning.common import WORKFLOW_STATE, ITEM_STATE, update_post_item, ITEM_ACTIONS, \
is_valid_event_planning_reason, ASSIGNMENT_WORKFLOW_STATE
from flask import request


planning_cancel_schema = deepcopy(planning_schema)
planning_cancel_schema['reason'] = {
'type': 'string',
'nullable': True,
}
planning_cancel_schema['event_cancellation'] = {
'type': 'boolean',
'nullable': True
}

planning_cancel_schema['cancel_all_coverage'] = {
'type': 'boolean',
'nullable': True
Expand Down Expand Up @@ -61,7 +59,7 @@ def update(self, id, updates, original):
_id='newscoveragestatus'
)

event_cancellation = updates.pop('event_cancellation', False)
event_cancellation = request.view_args.get('event_cancellation')
cancel_all_coverage = updates.pop('cancel_all_coverage', False)
event_reschedule = updates.pop('event_reschedule', False)

Expand Down Expand Up @@ -122,8 +120,9 @@ def _cancel_plan(self, updates, reason):

def on_updated(self, updates, original):
lock_action = original.get('lock_action')
if lock_action in [ITEM_ACTIONS.EDIT, ITEM_ACTIONS.PLANNING_CANCEL,
ITEM_ACTIONS.CANCEL_ALL_COVERAGE] or self.is_related_event_completed(updates, original):
allowed_actions = [ITEM_ACTIONS.EDIT, ITEM_ACTIONS.PLANNING_CANCEL, ITEM_ACTIONS.CANCEL_ALL_COVERAGE]
if request.view_args.get('event_cancellation') or lock_action in allowed_actions or \
self.is_related_event_completed(updates, original):
update_post_item(updates, original)

def is_related_event_completed(self, updates, original):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="superdesk-planning",
version="1.10.1-rc3",
version="1.10.1-rc4",
package_dir={'': 'server'},
packages=find_packages('server'),
package_data=package_data,
Expand Down

0 comments on commit 6c29726

Please sign in to comment.