diff --git a/scripts/apps/authoring-react/article-widgets/comments/index.tsx b/scripts/apps/authoring-react/article-widgets/comments/index.tsx index 08e7bc21ea..34341d35ac 100644 --- a/scripts/apps/authoring-react/article-widgets/comments/index.tsx +++ b/scripts/apps/authoring-react/article-widgets/comments/index.tsx @@ -4,6 +4,7 @@ import {IArticleSideWidget, IArticleSideWidgetComponentType, IComment, IRestApiR import {gettext} from 'core/utils'; import CommentsWidget from '../../generic-widgets/comments/CommentsWidget'; import {httpRequestJsonLocal} from 'core/helpers/network'; +import {notify} from 'core/notify/notify'; // Can't call `gettext` in the top level const getLabel = () => gettext('Comments'); @@ -49,7 +50,13 @@ class Component extends React.PureComponent { item: this.props.article._id, text: text, }, - }); + }) + .then((res: void) => res) + .catch((error) => { + if (error.data._issues?.text != null) { + notify.error(error.data._issues.text); + } + }); }} /> ); diff --git a/scripts/apps/authoring/comments/comments.ts b/scripts/apps/authoring/comments/comments.ts index 3616391789..e03204a0a4 100644 --- a/scripts/apps/authoring/comments/comments.ts +++ b/scripts/apps/authoring/comments/comments.ts @@ -1,3 +1,4 @@ +import {notify} from 'core/notify/notify'; import {gettext} from 'core/utils'; import {each} from 'lodash'; @@ -22,7 +23,11 @@ function CommentsService(api) { }; this.save = function(comment) { - return api.item_comments.save(comment); + return api.item_comments.save(comment).catch((error) => { + if (error.data._issues?.text != null) { + notify.error(error.data._issues.text); + } + }); }; } diff --git a/scripts/apps/authoring/views/change-image.html b/scripts/apps/authoring/views/change-image.html index dcf6484569..5fa63af5de 100644 --- a/scripts/apps/authoring/views/change-image.html +++ b/scripts/apps/authoring/views/change-image.html @@ -1,4 +1,4 @@ -