Skip to content

Commit

Permalink
Unlink as coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc committed Aug 31, 2023
1 parent a9fe557 commit 677f7e5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
27 changes: 27 additions & 0 deletions client/planning-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {AssignmentsList} from './assignments-overview';
import {IPlanningExtensionConfigurationOptions} from './extension_configuration_options';
import {AutopostIngestRuleEditor} from './ingest_rule_autopost/AutopostIngestRuleEditor';
import {AutopostIngestRulePreview} from './ingest_rule_autopost/AutopostIngestRulePreview';
import ng from 'superdesk-core/scripts/core/services/ng';
// import {superdeskApi} from '../../../client/superdeskApi';

function onSpike(superdesk: ISuperdesk, item: IArticle) {
const {gettext} = superdesk.localization;
Expand Down Expand Up @@ -112,6 +114,31 @@ const extension: IExtension = {
contributions: {

Check failure on line 114 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 12 spaces but found 16

Check failure on line 114 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 12 spaces but found 16
entities: {

Check failure on line 115 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 16 spaces but found 20

Check failure on line 115 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 16 spaces but found 20
article: {

Check failure on line 116 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 20 spaces but found 24

Check failure on line 116 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 20 spaces but found 24
getActions: (item) => [

Check failure on line 117 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 24 spaces but found 28

Check failure on line 117 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 24 spaces but found 28
{

Check failure on line 118 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 28 spaces but found 32

Check failure on line 118 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 28 spaces but found 32
label: 'Unlink as Coverage',

Check failure on line 119 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 32 spaces but found 36

Check failure on line 119 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 32 spaces but found 36
groupId: 'planning-actions',

Check failure on line 120 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 32 spaces but found 36

Check failure on line 120 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 32 spaces but found 36
icon: 'cut',

Check failure on line 121 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 32 spaces but found 36

Check failure on line 121 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 32 spaces but found 36
onTrigger: () => {

Check failure on line 122 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 32 spaces but found 36

Check failure on line 122 in client/planning-extension/src/extension.ts

View workflow job for this annotation

GitHub Actions / client (14.x)

Expected indentation of 32 spaces but found 36
const authoring = ng.get('authoring');

if (
ng.get('privileges').userHasPrivileges({archive: 1}) &&
item.assignment_id != null &&
!ng.get('archiveService').isPersonal(item) &&
!superdesk.entities.article.isLockedInOtherSession(item) &&
(
authoring.itemActions(item).edit ||
authoring.itemActions(item).correct ||
authoring.itemActions(item).deschedule
)
) {
const event = new CustomEvent("planning:unlinkfromcoverage", {detail: {item}});
window.dispatchEvent(event);
}
},
}
],
onSpike: (item: IArticle) => onSpike(superdesk, item),
onSpikeMultiple: (items: Array<IArticle>) => onSpikeMultiple(superdesk, items),
onPublish: (item: IArticle) => onPublishArticle(superdesk, item),
Expand Down
12 changes: 11 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import planningModule from './client';
import * as ctrl from './client/controllers';
import {gettext} from './client/utils/gettext';
import {isContentLinkToCoverageAllowed} from './client/utils/archive';

import ng from 'superdesk-core/scripts/core/services/ng';

configurePlanning.$inject = ['superdeskProvider'];
function configurePlanning(superdesk) {
Expand Down Expand Up @@ -134,5 +134,15 @@ function configurePlanning(superdesk) {
});
}

window.addEventListener('planning:unlinkfromcoverage', (event: CustomEvent) => {
ctrl.UnlinkAssignmentController(
event.detail,
ng.get('notify'),
ng.get('gettext'),
ng.get('api'),
ng.get('lock'),
);
});

export default planningModule
.config(configurePlanning);

0 comments on commit 677f7e5

Please sign in to comment.