Skip to content

Commit

Permalink
Improve the config options for the fields shown in the Publish and Se…
Browse files Browse the repository at this point in the history
…nd to Panel (#4703)
  • Loading branch information
dzonidoo authored Dec 18, 2024
1 parent beda728 commit 53b5136
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 70 deletions.
43 changes: 0 additions & 43 deletions e2e/client/specs/content_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,47 +217,4 @@ describe('content', () => {

element(by.id('closeAuthoringBtn')).click();
});

it('can set embargo and send', () => {
// Initial steps before proceeding, to get initial state of send buttons.
workspace.editItem('item3', 'SPORTS');
authoring.sendTo('Sports Desk', 'Incoming Stage');
authoring.confirmSendTo();

workspace.editItem('item3', 'SPORTS');

el(['open-send-publish-pane']).click();

el(['authoring', 'interactive-actions-panel', 'tabs'], by.buttonText('Send to')).click();

const sendToButton = el(['authoring', 'interactive-actions-panel', 'send']);

browser.wait(ECE.visibilityOf(sendToButton));

new TreeSelectDriver(
el(['interactive-actions-panel', 'destination-select']),
).setValue('Sports Desk');

const stage = 'two';

// State after selecting different Stage in the same desk
el(
['interactive-actions-panel', 'stage-select'],
by.cssContainingText('[data-test-id="item"]', stage),
).click();

expect(sendToButton.isEnabled()).toBe(true);

// State after setting Embargo
setEmbargo();
browser.sleep(100);
expect(sendToButton.isEnabled()).toBe(true);

// State after changing Desk
new TreeSelectDriver(
el(['interactive-actions-panel', 'destination-select']),
).setValue('Politic Desk');

expect(sendToButton.isEnabled()).toBe(true);
});
});
52 changes: 44 additions & 8 deletions scripts/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,50 @@ if (appConfig.shortTimeFormat == null) {
appConfig.shortTimeFormat = 'HH:mm'; // 24h format
}

if (appConfig.ui == null) {
appConfig.ui = {};
}

if (appConfig.ui.sendEmbargo == null) {
appConfig.ui.sendEmbargo = false;
}

if (appConfig.ui.italicAbstract == null) {
appConfig.ui.italicAbstract = true;
}

if (appConfig.ui.publishEmbargo == null) {
appConfig.ui.publishEmbargo = true;
}

if (appConfig.authoring == null) {
appConfig.authoring = {};
}

if (appConfig.authoring.panels == null) {
appConfig.authoring.panels = {};
}

if (appConfig.authoring.panels.publish == null) {
appConfig.authoring.panels.publish = {};
}

if (appConfig.authoring.panels.publish.publishSchedule == null) {
appConfig.authoring.panels.publish.publishSchedule = true;
}

if (appConfig.authoring.panels.publish.publishingTarget == null) {
appConfig.authoring.panels.publish.publishingTarget = true;
}

if (appConfig.authoring.panels.sendTo == null) {
appConfig.authoring.panels.sendTo = {};
}

if (appConfig.authoring.panels.sendTo.publishSchedule == null) {
appConfig.authoring.panels.sendTo.publishSchedule = false;
}

const defaultDateFormat = 'MM/DD';
const defaultTimeFormat = 'hh:mm';

Expand All @@ -34,14 +78,6 @@ if (appConfig.longDateFormat == null) {
appConfig.longDateFormat = 'LLL';
}

if (appConfig.ui == null) {
appConfig.ui = {};

if (appConfig.ui.italicAbstract == null) {
appConfig.ui.italicAbstract = true;
}
}

if (appConfig.features == null) {
appConfig.features = {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,26 +223,31 @@ export class WithPublishTab extends React.PureComponent<IProps, IState> {
},
);
}}
allowSettingEmbargo={appConfig.ui.publishEmbargo !== false}
allowSettingEmbargo={appConfig.ui.publishEmbargo}
allowSettingPublishSchedule={
appConfig.authoring.panels.publish.publishSchedule
}
/>

<PublishingTargetSelect
value={this.state.publishingTarget}
onChange={(val) => {
this.setState(
{publishingTarget: val},
() => {
this.props.onDataChange?.({
...this.props.item,
...getPublishingTargetPatch(
this.props.item,
this.state.publishingTarget,
),
});
},
);
}}
/>
{appConfig.authoring.panels.publish.publishingTarget && (
<PublishingTargetSelect
value={this.state.publishingTarget}
onChange={(val) => {
this.setState(
{publishingTarget: val},
() => {
this.props.onDataChange?.({
...this.props.item,
...getPublishingTargetPatch(
this.props.item,
this.state.publishingTarget,
),
});
},
);
}}
/>
)}
</div>

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export class SendToTab extends React.PureComponent<IProps, IState> {
this.setState({publishingDateOptions: val});
}}
allowSettingEmbargo={appConfig.ui.sendEmbargo !== false}
allowSettingPublishSchedule={appConfig.authoring.panels.sendTo.publishSchedule}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ interface IProps {
value: IPublishingDateOptions;
onChange(value: IPublishingDateOptions): void;
allowSettingEmbargo: boolean;
allowSettingPublishSchedule?: boolean;
}

export class PublishingDateOptions extends React.PureComponent<IProps> {
Expand All @@ -76,7 +77,7 @@ export class PublishingDateOptions extends React.PureComponent<IProps> {
&& this.props.allowSettingEmbargo
&& sdApi.user.hasPrivilege('embargo');

const canSetPublishSchedule = embargo == null;
const canSetPublishSchedule = embargo == null && this.props.allowSettingPublishSchedule;

return (
<div>
Expand Down
10 changes: 10 additions & 0 deletions scripts/core/superdesk-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,16 @@ declare module 'superdesk-api' {
preview?: {
hideContentLabels: boolean;
};

panels?: {
publish?: {
publishSchedule?: boolean
publishingTarget?: boolean;
}
sendTo?: {
publishSchedule?: boolean;
}
}
};
ui: {
/**
Expand Down

0 comments on commit 53b5136

Please sign in to comment.