Skip to content

Commit

Permalink
[TGA-59] fix(author_approval): incorrect watch function signature (#4340
Browse files Browse the repository at this point in the history
)

* [TGA-59] fix(author_approval): incorrect watch function signature

* Fix article update after it's been signed off

* fix lint issue, dont wipe extra on update

---------

Co-authored-by: thecalcc <[email protected]>
  • Loading branch information
MarkLark86 and thecalcc authored Oct 13, 2023
1 parent 9194901 commit 4950266
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ export function ArticleEditDirective(
}
}

// Needed only for authoring Angular. In authoring react we have a generic
// event ('resource:updated') which listens to all item changes.
scope.$on('author_approval:updated', (_event, extra) => {
if (extra.item_id === scope.item?._id) {
if (scope.item.extra == null) {
scope.item.extra = {};
}

scope.item.extra.publish_sign_off = extra.new_sign_off;
scope.$apply();
}
});

scope.$watch('item.language', () => {
scope.monthNames = getMonthNamesShort(scope.item.language ?? appConfig.default_language)
.map((label, i) => ({id: i.toString(), label: label}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ export function AuthoringContainerDirective(authoringWorkspace: AuthoringWorkspa
scope: {},
require: 'sdAuthoringContainer',
link: function(scope, elem, attrs, ctrl) {
// Needed only for authoring Angular. In authoring react we have a generic
// event ('resource:updated') which listens to all item changes.
scope.$on('author_approval:updated', (event) => {
if (event.item_id === scope.item._id) {
scope.item.extra.publish_sign_off = event.sign_off_new_data;
}
});

scope.$watch(authoringWorkspace.getState, (state) => {
if (state) {
if (itemInEditMode != null) {
Expand Down

0 comments on commit 4950266

Please sign in to comment.