Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run middleware on priority change instantly #4425

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {getReadOnlyLabel} from './ArticleEditDirective';
import {translateArticleType, gettext} from 'core/utils';
import {IArticle} from 'superdesk-api';
import {slideUpDown} from 'core/ui/slide-up-down';
import {runBeforeUpdateMiddlware} from '../services/AuthoringService';

AuthoringHeaderDirective.$inject = [
'api',
Expand Down Expand Up @@ -223,6 +224,16 @@ export function AuthoringHeaderDirective(
return Promise.resolve();
}

/**
* Applies changes of the priority field instantly without the timeout introduced by autosave.
* Specifically implemented because of custom ANSA headline changes functionality,
* triggered on priority field change. (SDANSA-531)
*/
scope.priorityCustomFunction = () => {
runBeforeUpdateMiddlware(scope.item, scope.origItem);
scope.autosave(scope.item);
};

/**
* Sets the anpa category corresponding to the required subservice: if a subservice
* field (defined in vocabularies) was declared as required in a content profile
Expand Down
4 changes: 2 additions & 2 deletions scripts/apps/authoring/views/authoring-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
data-label="Priority"
ng-disabled="!_editable || schema.priority.readonly === true"
data-key="qcode"
data-change="autosave(item)"
data-change="priorityCustomFunction()"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autosavePriority() would be a better name

tabindex="{{editor.priority.order}}">
</div>
<div class="authoring-header__hint" ng-if="helper_text.priority">{{helper_text.priority}}</div>
Expand Down Expand Up @@ -635,5 +635,5 @@
</div>

<div class="authoring-header__toggle-container">
<button class="authoring-header__toggle" ng-class="{active: isCollapsed}" ng-click="toggleCollapsed()" tabindex="-1"><i class="icon-chevron-up-thin"></i></button>
<button class="authoring-header__toggle" ng-class="{active: isCollapsed}" ng-click="toggleCollapsed()" tabindex="-1"><i class="icon-chevron-up-thin"></i></button>
</div>
Loading