From aba6c1bddcfad8addf0fcc2e39a82e423ed06ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ja=C5=A1ek?= Date: Mon, 7 Aug 2023 15:39:44 +0200 Subject: [PATCH 1/9] fix e2e server version (#4304) --- e2e/server/requirements.in | 2 +- e2e/server/requirements.txt | 103 ++++++++++++++++++++++-------------- 2 files changed, 65 insertions(+), 40 deletions(-) diff --git a/e2e/server/requirements.in b/e2e/server/requirements.in index 3c7d78fb7d..b8080cf826 100644 --- a/e2e/server/requirements.in +++ b/e2e/server/requirements.in @@ -1,3 +1,3 @@ honcho gunicorn -git+https://github.com/superdesk/superdesk-core.git@v2.6.0#egg=Superdesk-Core +git+https://github.com/superdesk/superdesk-core.git@hotfix/2.6.5#egg=Superdesk-Core diff --git a/e2e/server/requirements.txt b/e2e/server/requirements.txt index f18956dfae..ec52d42723 100644 --- a/e2e/server/requirements.txt +++ b/e2e/server/requirements.txt @@ -4,15 +4,17 @@ # # pip-compile requirements.in # -amqp==2.6.1 +amqp==5.1.1 # via kombu arrow==0.13.0 # via # eve-elastic # superdesk-core +async-timeout==4.0.2 + # via redis authlib==0.14.3 # via superdesk-core -babel==2.10.3 +babel==2.12.1 # via flask-babel bcrypt==3.1.7 # via superdesk-core @@ -24,21 +26,21 @@ blinker==1.4 # flask-mail # raven # superdesk-core -boto3==1.24.82 +boto3==1.28.20 # via superdesk-core -botocore==1.27.82 +botocore==1.31.20 # via # boto3 # s3transfer -cachetools==5.2.0 +cachetools==5.3.1 # via flask-oidc-ex -celery[redis]==4.4.7 +celery[redis]==5.2.7 # via superdesk-core cerberus==1.3.4 # via # eve # superdesk-core -certifi==2022.9.24 +certifi==2023.7.22 # via # elastic-apm # elasticsearch @@ -49,35 +51,48 @@ cffi==1.15.1 # cryptography chardet==3.0.4 # via superdesk-core -charset-normalizer==2.1.1 +charset-normalizer==3.2.0 # via requests ciso8601==1.0.8 # via eve-elastic -click==7.1.2 - # via flask +click==8.1.6 + # via + # celery + # click-didyoumean + # click-plugins + # click-repl + # flask +click-didyoumean==0.3.0 + # via celery +click-plugins==1.1.1 + # via celery +click-repl==0.3.0 + # via celery croniter==0.3.37 # via superdesk-core -cryptography==38.0.1 +cryptography==41.0.3 # via # authlib # jwcrypto -deprecated==1.2.13 +deprecated==1.2.14 # via jwcrypto draftjs-exporter[lxml]==2.1.7 # via superdesk-core -elastic-apm[flask]==6.7.2 +ecs-logging==2.0.2 + # via elastic-apm +elastic-apm[flask]==6.18.0 # via superdesk-core elasticsearch==7.13.4 # via eve-elastic eve==1.1.2 # via superdesk-core -eve-elastic==7.3.0 +eve-elastic==7.3.1 # via superdesk-core events==0.3 # via eve feedparser==6.0.10 # via superdesk-core -flask==1.1.4 +flask==1.1.2 # via # eve # flask-babel @@ -94,17 +109,17 @@ flask-oidc-ex==0.5.5 # via superdesk-core flask-script==2.0.6 # via superdesk-core -future==0.18.2 +future==0.18.3 # via python-twitter -gunicorn==20.0.4 +gunicorn==21.2.0 # via -r requirements.in hachoir==3.0a3 # via superdesk-core hermescache==0.10.0 # via superdesk-core -honcho==1.0.1 +honcho==1.1.0 # via -r requirements.in -httplib2==0.20.4 +httplib2==0.22.0 # via oauth2client idna==3.4 # via requests @@ -112,19 +127,21 @@ itsdangerous==1.1.0 # via # flask # flask-oidc-ex + # superdesk-core jinja2==2.11.3 # via # flask # flask-babel + # superdesk-core jmespath==1.0.1 # via # boto3 # botocore -jwcrypto==1.4.2 +jwcrypto==1.5.0 # via # flask-oidc-ex # python-jwt -kombu==4.6.11 +kombu==5.2.4 # via # celery # superdesk-core @@ -140,21 +157,25 @@ markupsafe==2.0.1 # superdesk-core mongolock==1.3.4 # via superdesk-core -natsort==8.2.0 +natsort==8.4.0 # via croniter oauth2client==4.1.3 # via flask-oidc-ex -oauthlib==3.2.1 +oauthlib==3.2.2 # via requests-oauthlib +packaging==23.1 + # via gunicorn pillow==9.2.0 # via superdesk-core -pyasn1==0.4.8 +prompt-toolkit==3.0.39 + # via click-repl +pyasn1==0.5.0 # via # ldap3 # oauth2client # pyasn1-modules # rsa -pyasn1-modules==0.2.8 +pyasn1-modules==0.3.0 # via oauth2client pycparser==2.21 # via cffi @@ -163,7 +184,7 @@ pymongo==3.11.4 # eve # mongolock # superdesk-core -pyparsing==3.0.9 +pyparsing==3.1.1 # via httplib2 python-dateutil==2.7.5 # via @@ -177,25 +198,24 @@ python-magic==0.4.27 # via superdesk-core python-twitter==3.5 # via superdesk-core -pytz==2022.2.1 +pytz==2023.3 # via - # babel # celery # eve-elastic # flask-babel # superdesk-core # tzlocal -pyyaml==5.4.1 +pyyaml==6.0.1 # via superdesk-core raven[flask]==6.10.0 # via superdesk-core -redis==3.2.1 +redis==4.5.5 # via # celery # superdesk-core regex==2020.7.14 # via superdesk-core -requests==2.28.1 +requests==2.31.0 # via # python-twitter # requests-oauthlib @@ -204,11 +224,11 @@ requests-oauthlib==1.3.1 # via python-twitter rsa==4.9 # via oauth2client -s3transfer==0.6.0 +s3transfer==0.6.1 # via boto3 sgmllib3k==1.0.0 # via feedparser -simplejson==3.17.6 +simplejson==3.19.1 # via eve six==1.16.0 # via @@ -216,13 +236,13 @@ six==1.16.0 # flask-oidc-ex # oauth2client # python-dateutil -superdesk-core @ git+https://github.com/superdesk/superdesk-core.git@v2.6.0 +superdesk-core @ git+https://github.com/superdesk/superdesk-core.git@hotfix/2.6.5 # via -r requirements.in -typing-extensions==4.3.0 +typing-extensions==4.7.1 # via superdesk-core tzlocal==2.1 # via superdesk-core -unidecode==0.04.21 +unidecode==0.4.21 # via superdesk-core urllib3==1.25.11 # via @@ -231,18 +251,23 @@ urllib3==1.25.11 # elasticsearch # requests # superdesk-core -vine==1.3.0 +vine==5.0.0 # via # amqp # celery + # kombu +wcwidth==0.2.6 + # via prompt-toolkit websockets==10.3 # via superdesk-core werkzeug==1.0.1 # via # flask # superdesk-core -wrapt==1.14.1 - # via deprecated +wrapt==1.15.0 + # via + # deprecated + # elastic-apm # The following packages are considered to be unsafe in a requirements file: # setuptools From 18f1b8dd7da2bbc3409459bb7750499f999a74d3 Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Thu, 10 Aug 2023 16:06:09 +0200 Subject: [PATCH 2/9] 3.0.53 (#4306) --- package-lock.json | 20 ++++++++++---------- package.json | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3c748482a..a6feeae85e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -331,9 +331,9 @@ }, "dependencies": { "tslib": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", - "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==" + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", + "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" } } }, @@ -13253,7 +13253,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" } } }, @@ -16253,9 +16253,9 @@ } }, "superdesk-ui-framework": { - "version": "3.0.47", - "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-3.0.47.tgz", - "integrity": "sha512-r6M7a8jCOdS9UOmf629YbcF8LzpaHUFhhMP66FrOSNfntu9uSJn/L7NWdoM7/tcl19wPlL9EMPx+E/E9b6Ibsg==", + "version": "3.0.53", + "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-3.0.53.tgz", + "integrity": "sha512-A6j/vVP5EzN5tcfHYJCtXsInySiCYGs+L4WmrJplTboLuGPZ3vhHtivzm/LZqx+kk4N/u7JedmGqSMl6z6K5dQ==", "requires": { "@material-ui/lab": "^4.0.0-alpha.56", "@popperjs/core": "^2.4.0", @@ -16278,9 +16278,9 @@ }, "dependencies": { "@types/node": { - "version": "14.18.53", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.53.tgz", - "integrity": "sha512-soGmOpVBUq+gaBMwom1M+krC/NNbWlosh4AtGA03SyWNDiqSKtwp7OulO1M6+mg8YkHMvJ/y0AkCeO8d1hNb7A==" + "version": "14.18.54", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.54.tgz", + "integrity": "sha512-uq7O52wvo2Lggsx1x21tKZgqkJpvwCseBBPtX/nKQfpVlEsLOb11zZ1CRsWUKvJF0+lzuA9jwvA7Pr2Wt7i3xw==" }, "cheerio": { "version": "1.0.0-rc.12", diff --git a/package.json b/package.json index 15cebcf161..0ac30ed85a 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "sass-loader": "6.0.6", "shortid": "2.2.8", "style-loader": "0.20.2", - "superdesk-ui-framework": "^3.0.47", + "superdesk-ui-framework": "^3.0.53", "ts-loader": "3.5.0", "tslint": "5.11.0", "typescript": "~4.9.5", From 67cee3cbf58134a6e21a7693b5ab536b0a3a2217 Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Thu, 17 Aug 2023 12:55:15 +0200 Subject: [PATCH 3/9] Improve select user component to show and allow filtering by sign off (#4310) --- package-lock.json | 6 +- package.json | 2 +- .../components/UserActivityWidget.tsx | 3 +- scripts/core/superdesk-api.d.ts | 2 + scripts/core/ui/components/SelectUser.tsx | 112 +++++++++++------- scripts/core/utils.ts | 1 + .../src/get-mark-for-user-modal.tsx | 1 + 7 files changed, 82 insertions(+), 45 deletions(-) diff --git a/package-lock.json b/package-lock.json index a6feeae85e..4aa287078b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16253,9 +16253,9 @@ } }, "superdesk-ui-framework": { - "version": "3.0.53", - "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-3.0.53.tgz", - "integrity": "sha512-A6j/vVP5EzN5tcfHYJCtXsInySiCYGs+L4WmrJplTboLuGPZ3vhHtivzm/LZqx+kk4N/u7JedmGqSMl6z6K5dQ==", + "version": "3.0.54", + "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-3.0.54.tgz", + "integrity": "sha512-wWtx2AEJUEShU7v60KteMcPW+vfP0iI3KDnWxnBxsNm6Y7T/nT2ROrd2U5dM/fjNt41jJEiP+AD7mN3ykX8Q4g==", "requires": { "@material-ui/lab": "^4.0.0-alpha.56", "@popperjs/core": "^2.4.0", diff --git a/package.json b/package.json index 0ac30ed85a..b6e8448e6f 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "sass-loader": "6.0.6", "shortid": "2.2.8", "style-loader": "0.20.2", - "superdesk-ui-framework": "^3.0.53", + "superdesk-ui-framework": "^3.0.54", "ts-loader": "3.5.0", "tslint": "5.11.0", "typescript": "~4.9.5", diff --git a/scripts/apps/dashboard/user-activity/components/UserActivityWidget.tsx b/scripts/apps/dashboard/user-activity/components/UserActivityWidget.tsx index cefbffc3cc..f4d142b8db 100644 --- a/scripts/apps/dashboard/user-activity/components/UserActivityWidget.tsx +++ b/scripts/apps/dashboard/user-activity/components/UserActivityWidget.tsx @@ -346,12 +346,13 @@ export default class UserActivityWidget extends React.Component >
{ this.props.onUserChange(user); }} horizontalSpacing={true} + clearable={false} /> diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts index c70559391a..3c02189f74 100644 --- a/scripts/core/superdesk-api.d.ts +++ b/scripts/core/superdesk-api.d.ts @@ -1176,6 +1176,8 @@ declare module 'superdesk-api' { disabled?: boolean; autoFocus?: boolean; horizontalSpacing?: boolean; + valueTemplate?: React.ComponentType<{option: IUser}>; + clearable: boolean; } export interface IDropdownTreeGroup { diff --git a/scripts/core/ui/components/SelectUser.tsx b/scripts/core/ui/components/SelectUser.tsx index c1bf37e808..c0f5b49572 100644 --- a/scripts/core/ui/components/SelectUser.tsx +++ b/scripts/core/ui/components/SelectUser.tsx @@ -1,8 +1,9 @@ +/* eslint-disable react/no-multi-comp */ import React from 'react'; import {IPropsSelectUser, IUser, IRestApiResponse} from 'superdesk-api'; import {gettext, getUserSearchMongoQuery} from 'core/utils'; import {UserAvatar} from 'apps/users/components/UserAvatar'; -import {SelectWithTemplate} from 'superdesk-ui-framework/react'; +import {SelectWithTemplate, Spacer} from 'superdesk-ui-framework/react'; import {httpRequestJsonLocal} from 'core/helpers/network'; import {SuperdeskReactComponent} from 'core/SuperdeskReactComponent'; @@ -10,6 +11,52 @@ interface IState { selectedUser: IUser | null | 'loading'; } +const itemTemplate = (props: {option: IUser}) => { + const user: IUser | null = props.option; + + return user == null + ? ( +
+ {gettext('Select a user')} +
+ ) + : ( + + +
+ +
+ + +
{user.display_name}
+
@{user.username}
+
+ +
+ +
{user.sign_off}
+
+ ); +}; + +const valueTemplateDefault = (props: {option: IUser}) => { + const user: IUser | null = props.option; + + return user == null + ? ( +
+ {gettext('Select a user')} +
+ ) + : ( + + + + {user.display_name} + + ); +}; + export class SelectUser extends SuperdeskReactComponent { constructor(props: IPropsSelectUser) { super(props); @@ -37,24 +84,26 @@ export class SelectUser extends SuperdeskReactComponent({ - method: 'GET', - path: `/users/${this.props.selectedUserId}`, - }).then((selectedUser) => { + if (prevProps.selectedUserId !== this.props.selectedUserId) { + // state.user needs to be updated if props.selectedUserId changes + if (this.props.selectedUserId == null) { // eslint-disable-next-line react/no-did-update-set-state - this.setState({selectedUser}); - }); + this.setState({selectedUser: null}); + } else if ( + this.state.selectedUser === 'loading' + || this.state.selectedUser?._id !== this.props.selectedUserId + ) { + // eslint-disable-next-line react/no-did-update-set-state + this.setState({selectedUser: 'loading'}); + + this.asyncHelpers.httpRequestJsonLocal({ + method: 'GET', + path: `/users/${this.props.selectedUserId}`, + }).then((selectedUser) => { + // eslint-disable-next-line react/no-did-update-set-state + this.setState({selectedUser}); + }); + } } } @@ -63,6 +112,8 @@ export class SelectUser extends SuperdeskReactComponent option.display_name} - itemTemplate={ - (props) => { - const user = props.option; - - return user == null - ? ( -
- {gettext('Select a user')} -
- ) - : ( -
- -
-
{user.display_name}
-
@{user.username}
-
-
- ); - } - } + itemTemplate={itemTemplate} + valueTemplate={valueTemplate} areEqual={(a, b) => a._id === b._id} autoFocus={this.props.autoFocus} autoOpen={this.state.selectedUser == null} @@ -137,7 +169,7 @@ export class SelectUser extends SuperdeskReactComponent ); } diff --git a/scripts/core/utils.ts b/scripts/core/utils.ts index 7f8a91971a..bc18522b17 100644 --- a/scripts/core/utils.ts +++ b/scripts/core/utils.ts @@ -187,6 +187,7 @@ export function getUserSearchMongoQuery(searchString: string) { {first_name: {$regex: searchString, $options: '-i'}}, {last_name: {$regex: searchString, $options: '-i'}}, {email: {$regex: searchString, $options: '-i'}}, + {sign_off: {$regex: searchString, $options: '-i'}}, ], }; } diff --git a/scripts/extensions/markForUser/src/get-mark-for-user-modal.tsx b/scripts/extensions/markForUser/src/get-mark-for-user-modal.tsx index e7959a29b2..ae9e1adcda 100644 --- a/scripts/extensions/markForUser/src/get-mark-for-user-modal.tsx +++ b/scripts/extensions/markForUser/src/get-mark-for-user-modal.tsx @@ -78,6 +78,7 @@ export function getMarkForUserModal(options: { onSelect={(selectedUser) => this.setState({selectedUserId: selectedUser._id})} selectedUserId={this.state.selectedUserId} autoFocus={true} + clearable={false} /> From 80d6f2545460c975a1b30fb4fe075feec9866dfc Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Fri, 18 Aug 2023 11:14:14 +0200 Subject: [PATCH 4/9] remove sign off from user select (#4311) --- scripts/core/ui/components/SelectUser.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/core/ui/components/SelectUser.tsx b/scripts/core/ui/components/SelectUser.tsx index c0f5b49572..d910ecad8f 100644 --- a/scripts/core/ui/components/SelectUser.tsx +++ b/scripts/core/ui/components/SelectUser.tsx @@ -22,19 +22,15 @@ const itemTemplate = (props: {option: IUser}) => { ) : ( - -
- -
- - -
{user.display_name}
-
@{user.username}
-
+
+ +
+ +
{user.display_name}
+
@{user.username}
-
{user.sign_off}
); }; From ce18b3b9a4a7f25597830090dcac4da9b7411433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ja=C5=A1ek?= Date: Fri, 18 Aug 2023 16:28:59 +0200 Subject: [PATCH 5/9] make sure description text is plain text without html (#4309) SDCP-710 --- scripts/apps/authoring/views/article-edit.html | 1 + scripts/core/editor3/components/Editor3Component.tsx | 2 ++ scripts/core/editor3/directive.tsx | 9 +++++++++ scripts/core/editor3/reducers/editor3.tsx | 2 +- scripts/core/editor3/store/index.ts | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/apps/authoring/views/article-edit.html b/scripts/apps/authoring/views/article-edit.html index 834565a013..0bb531ea26 100644 --- a/scripts/apps/authoring/views/article-edit.html +++ b/scripts/apps/authoring/views/article-edit.html @@ -482,6 +482,7 @@ data-tabindex="editor.description_text.order" data-clean-pasted-html="editor.description_text.cleanPastedHTML" data-limit="schema.description_text.maxlength" + data-plain-text="true" > diff --git a/scripts/core/editor3/components/Editor3Component.tsx b/scripts/core/editor3/components/Editor3Component.tsx index e661e62e0a..265eac455e 100644 --- a/scripts/core/editor3/components/Editor3Component.tsx +++ b/scripts/core/editor3/components/Editor3Component.tsx @@ -119,6 +119,7 @@ interface IProps { editorState?: EditorState; scrollContainer?: string; singleLine?: boolean; + plainText?: boolean; editorFormat?: Array; tabindex?: number; suggestingMode?: boolean; @@ -690,6 +691,7 @@ export class Editor3Component extends React.Component { Editor3Component.defaultProps = { readOnly: false, singleLine: false, + plainText: false, cleanPastedHtml: false, editorFormat: [], }; diff --git a/scripts/core/editor3/directive.tsx b/scripts/core/editor3/directive.tsx index 7acd8aa5d3..2523846e2f 100644 --- a/scripts/core/editor3/directive.tsx +++ b/scripts/core/editor3/directive.tsx @@ -64,6 +64,7 @@ class Editor3Directive { readOnly: any; findReplaceTarget: any; singleLine: any; + plainText?: boolean; debounce: any; bindToValue: any; tabindex: any; @@ -202,6 +203,12 @@ class Editor3Directive { cleanPastedHtml: '=?', limit: '=?', + + /** + * @type {String} + * @description Force the output to be plain text and not contain any html. + */ + plainText: '=?', }; } @@ -227,6 +234,7 @@ class Editor3Directive { this.findReplaceTarget = typeof this.findReplaceTarget !== 'undefined'; this.singleLine = this.singleLine || false; + this.plainText = this.plainText || false; this.debounce = parseInt(this.debounce || '100', 10); this.bindToValue = this.bindToValue || false; this.tabindex = this.tabindex || 0; @@ -256,6 +264,7 @@ class Editor3Directive { singleLine={this.singleLine} cleanPastedHtml={this.cleanPastedHtml} autocompleteSuggestions={autocompleteSuggestions} + plainText={this.plainText} /> , diff --git a/scripts/core/editor3/reducers/editor3.tsx b/scripts/core/editor3/reducers/editor3.tsx index b75f60c63a..8cc3f33b64 100644 --- a/scripts/core/editor3/reducers/editor3.tsx +++ b/scripts/core/editor3/reducers/editor3.tsx @@ -160,7 +160,7 @@ export const onChange = ( const contentChanged = state.editorState.getCurrentContent() !== editorStateNext.getCurrentContent(); if (!skipOnChange && (contentChanged || force)) { - const plainText = state.singleLine === true; + const plainText = state.plainText === true || state.singleLine === true; state.onChangeValue(editorStateNext.getCurrentContent(), {plainText}); } diff --git a/scripts/core/editor3/store/index.ts b/scripts/core/editor3/store/index.ts index 0586c0aedb..33b106f30f 100644 --- a/scripts/core/editor3/store/index.ts +++ b/scripts/core/editor3/store/index.ts @@ -55,6 +55,7 @@ interface IProps { onChange?: any; readOnly?: any; singleLine?: any; + plainText?: any; tabindex?: any; showTitle?: any; editorFormat?: Array; @@ -74,6 +75,7 @@ export interface IEditorStore { locked: boolean; showToolbar: any; singleLine: any; + plainText: boolean; tabindex: any; showTitle: any; activeCell?: IActiveCell; @@ -167,6 +169,7 @@ export default function createEditorStore( locked: false, // when true, main editor is disabled (ie. when editing sub-components like tables or images) showToolbar: (props.editorFormat || []).length > 0, singleLine: props.singleLine, + plainText: props.plainText, tabindex: props.tabindex, showTitle: props.showTitle, activeCell: null, // currently focused table cell From ed5e0ffd6b36ffc4097965cdc008a9984978316d Mon Sep 17 00:00:00 2001 From: Nikola Stojanovic <68916411+dzonidoo@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:40:50 +0200 Subject: [PATCH 6/9] fixed mark for highlight data (#4303) --- e2e/server/requirements.in | 2 +- e2e/server/requirements.txt | 20 +++++++++---------- .../highlights/services/HighlightsService.ts | 2 +- .../apps/highlights/tests/highlights.spec.ts | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/e2e/server/requirements.in b/e2e/server/requirements.in index b8080cf826..682db2be94 100644 --- a/e2e/server/requirements.in +++ b/e2e/server/requirements.in @@ -1,3 +1,3 @@ honcho gunicorn -git+https://github.com/superdesk/superdesk-core.git@hotfix/2.6.5#egg=Superdesk-Core +git+https://github.com/superdesk/superdesk-core.git@develop#egg=Superdesk-Core diff --git a/e2e/server/requirements.txt b/e2e/server/requirements.txt index ec52d42723..83e760db9d 100644 --- a/e2e/server/requirements.txt +++ b/e2e/server/requirements.txt @@ -10,7 +10,7 @@ arrow==0.13.0 # via # eve-elastic # superdesk-core -async-timeout==4.0.2 +async-timeout==4.0.3 # via redis authlib==0.14.3 # via superdesk-core @@ -26,9 +26,9 @@ blinker==1.4 # flask-mail # raven # superdesk-core -boto3==1.28.20 +boto3==1.28.30 # via superdesk-core -botocore==1.31.20 +botocore==1.31.30 # via # boto3 # s3transfer @@ -36,7 +36,7 @@ cachetools==5.3.1 # via flask-oidc-ex celery[redis]==5.2.7 # via superdesk-core -cerberus==1.3.4 +cerberus==1.3.5 # via # eve # superdesk-core @@ -55,13 +55,14 @@ charset-normalizer==3.2.0 # via requests ciso8601==1.0.8 # via eve-elastic -click==8.1.6 +click==8.1.7 # via # celery # click-didyoumean # click-plugins # click-repl # flask + # superdesk-core click-didyoumean==0.3.0 # via celery click-plugins==1.1.1 @@ -78,7 +79,7 @@ deprecated==1.2.14 # via jwcrypto draftjs-exporter[lxml]==2.1.7 # via superdesk-core -ecs-logging==2.0.2 +ecs-logging==2.1.0 # via elastic-apm elastic-apm[flask]==6.18.0 # via superdesk-core @@ -224,7 +225,7 @@ requests-oauthlib==1.3.1 # via python-twitter rsa==4.9 # via oauth2client -s3transfer==0.6.1 +s3transfer==0.6.2 # via boto3 sgmllib3k==1.0.0 # via feedparser @@ -236,7 +237,7 @@ six==1.16.0 # flask-oidc-ex # oauth2client # python-dateutil -superdesk-core @ git+https://github.com/superdesk/superdesk-core.git@hotfix/2.6.5 +superdesk-core @ git+https://github.com/superdesk/superdesk-core.git@develop # via -r requirements.in typing-extensions==4.7.1 # via superdesk-core @@ -268,6 +269,3 @@ wrapt==1.15.0 # via # deprecated # elastic-apm - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/scripts/apps/highlights/services/HighlightsService.ts b/scripts/apps/highlights/services/HighlightsService.ts index edf1a6f11e..ca00cb5833 100644 --- a/scripts/apps/highlights/services/HighlightsService.ts +++ b/scripts/apps/highlights/services/HighlightsService.ts @@ -111,7 +111,7 @@ export function HighlightsService(api, $q, $cacheFactory, packages: IPackagesSer * Mark an item for a highlight */ service.markItem = function(highlight, markedItem) { - return api.save('marked_for_highlights', {highlights: highlight, marked_item: markedItem._id}); + return api.save('marked_for_highlights', {highlights: [highlight], marked_item: markedItem._id}); }; /** diff --git a/scripts/apps/highlights/tests/highlights.spec.ts b/scripts/apps/highlights/tests/highlights.spec.ts index 3b0edcd665..fefbc1140b 100644 --- a/scripts/apps/highlights/tests/highlights.spec.ts +++ b/scripts/apps/highlights/tests/highlights.spec.ts @@ -10,7 +10,7 @@ describe('highlights', () => { it('can mark item for highlights', inject((highlightsService, api, $q) => { spyOn(api, 'save').and.returnValue($q.when({})); highlightsService.markItem('h1', {_id: 'id', guid: 'guid'}); - expect(api.save).toHaveBeenCalledWith('marked_for_highlights', {highlights: 'h1', marked_item: 'id'}); + expect(api.save).toHaveBeenCalledWith('marked_for_highlights', {highlights: ['h1'], marked_item: 'id'}); })); it('can save highlights configuration', inject((highlightsService, api, $q) => { From 3cc689b0f8f10ea21c76e551359fee05409db931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ja=C5=A1ek?= Date: Thu, 7 Sep 2023 10:11:44 +0200 Subject: [PATCH 7/9] fix e2e server requirements (#4317) * fix e2e server requirements * update client requirements * print chrome and webdriver versions when starting tests * print full browser version string * dump server logs on e2e failure * move version logging to onPrepare * update driver manager * limit logs to superdesk * disable celery * output browser console errors on failing tests * avoid elastic indexes to be created automatically * run celery in a separate process --------- Co-authored-by: Tomas Kikutis --- .github/workflows/tests.yml | 5 + e2e/client/package.json | 2 +- e2e/client/protractor.conf.js | 12 ++ e2e/client/run-end-to-end-tests.js | 4 +- e2e/client/specs/helpers/utils.ts | 7 +- e2e/server/Procfile | 1 + e2e/server/docker-compose.yml | 1 + e2e/server/requirements.txt | 6 +- e2e/server/settings.py | 4 +- package-lock.json | 285 ++++++++++++++++++++--------- package.json | 2 +- 11 files changed, 233 insertions(+), 96 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 453209e23f..e5870ca04b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,3 +62,8 @@ jobs: with: name: screenshots-e2e-${{ matrix.suite }} path: /tmp/*.png + + - name: Server Logs + if: ${{ failure() }} + run: docker-compose logs superdesk + working-directory: e2e/server diff --git a/e2e/client/package.json b/e2e/client/package.json index b7046fa058..43eaccc62c 100644 --- a/e2e/client/package.json +++ b/e2e/client/package.json @@ -12,7 +12,7 @@ "jasmine-reporters": "2.3.0", "protractor": "7.0.0", "typescript": "4.9.3", - "webdriver-manager": "^12.1.8" + "webdriver-manager": "^12.1.9" }, "scripts": { "build": "npx @superdesk/build-tools build-root-repo ./", diff --git a/e2e/client/protractor.conf.js b/e2e/client/protractor.conf.js index 44442b77b9..30790f90ee 100644 --- a/e2e/client/protractor.conf.js +++ b/e2e/client/protractor.conf.js @@ -1,6 +1,7 @@ /* eslint-disable comma-dangle */ var path = require('path'); +const execSync = require('child_process').execSync; function getChromeOptions() { var chromeOptions = { @@ -55,6 +56,16 @@ var config = { chromeDriver: process.env.CHROMEWEBDRIVER ? (process.env.CHROMEWEBDRIVER + '/chromedriver') : null, onPrepare: function() { + execSync( + ` + echo "chrome version:" && $CHROME_BIN --version + echo "\n" + echo "webdriver-manager version:" && npx webdriver-manager version + echo "\n" + `, + {stdio: 'inherit'}, + ); + require('./specs/helpers/setup').setup({fixture_profile: 'app_prepopulate_data'}); // so it can be used without import in tests @@ -73,6 +84,7 @@ var config = { this.specDone = function(result) { if (result.failedExpectations.length > 0) { browser.screenshot(result.fullName.replace(/[^\w]+/g, '-')); + require('./specs/helpers/utils').printLogs(); } }; } diff --git a/e2e/client/run-end-to-end-tests.js b/e2e/client/run-end-to-end-tests.js index 3324ddde48..f0045a7da1 100644 --- a/e2e/client/run-end-to-end-tests.js +++ b/e2e/client/run-end-to-end-tests.js @@ -19,7 +19,7 @@ function installWebdriverDriver() { } catch (_) { // driver not installed, installing: - const version = execSync('$CHROME_BIN --product-version').toString();; + const version = execSync('$CHROME_BIN --product-version').toString(); if (version == null) { return reject('To launch the test server a chrome based browser has to be installed and CHROME_BIN environment variable set.'); @@ -38,7 +38,7 @@ ensurePackageInstalled() .then(() => { const argumentsToForward = process.argv.slice(2).join(' '); - return execSync(`npx protractor protractor.conf.js ${argumentsToForward}`, {stdio: 'inherit'}); + execSync(`npx protractor protractor.conf.js ${argumentsToForward}`, {stdio: 'inherit'}); }) .catch((e) => { console.error(e); diff --git a/e2e/client/specs/helpers/utils.ts b/e2e/client/specs/helpers/utils.ts index f53c076cf0..e24adcebe7 100644 --- a/e2e/client/specs/helpers/utils.ts +++ b/e2e/client/specs/helpers/utils.ts @@ -42,10 +42,9 @@ export function printLogs(prefix) { .then((browserLog) => { var logs = browserLog.filter((log) => log.level.value >= 1000); - console.info( - (prefix ? prefix + ' ' : '') + - 'log: ' + require('util').inspect(logs, {dept: 3}), - ); + for (const log of logs) { + console.error(`BROWSER CONSOLE ERROR: ${log.message}`); + } }); } diff --git a/e2e/server/Procfile b/e2e/server/Procfile index e74701f673..2b535105d0 100644 --- a/e2e/server/Procfile +++ b/e2e/server/Procfile @@ -1,2 +1,3 @@ rest: PYTHONUNBUFFERED=True gunicorn -c gunicorn_config.py wsgi wamp: python3 -u ws.py +work: celery -A worker worker diff --git a/e2e/server/docker-compose.yml b/e2e/server/docker-compose.yml index 852d26c356..ec72ee1053 100644 --- a/e2e/server/docker-compose.yml +++ b/e2e/server/docker-compose.yml @@ -24,6 +24,7 @@ services: - e2e environment: - discovery.type=single-node + - action.auto_create_index=false tmpfs: - /usr/share/elasticsearch/data diff --git a/e2e/server/requirements.txt b/e2e/server/requirements.txt index 83e760db9d..5b416f0532 100644 --- a/e2e/server/requirements.txt +++ b/e2e/server/requirements.txt @@ -26,9 +26,9 @@ blinker==1.4 # flask-mail # raven # superdesk-core -boto3==1.28.30 +boto3==1.28.37 # via superdesk-core -botocore==1.31.30 +botocore==1.31.37 # via # boto3 # s3transfer @@ -87,7 +87,7 @@ elasticsearch==7.13.4 # via eve-elastic eve==1.1.2 # via superdesk-core -eve-elastic==7.3.1 +eve-elastic==7.3.2 # via superdesk-core events==0.3 # via eve diff --git a/e2e/server/settings.py b/e2e/server/settings.py index fb0df3a1c8..c7372022c2 100644 --- a/e2e/server/settings.py +++ b/e2e/server/settings.py @@ -1,7 +1,7 @@ import os -DEBUG = bool(os.environ.get('SUPERDESK_DEBUG')) +DEBUG = False SUPERDESK_TESTING = True SERVER_NAME = 'localhost:5000' @@ -25,6 +25,6 @@ CONTENTAPI_ELASTICSEARCH_INDEX = CONTENTAPI_MONGO_DBNAME LEGAL_ARCHIVE = True -CELERY_TASK_ALWAYS_EAGER = True +CELERY_TASK_ALWAYS_EAGER = False DEFAULT_TIMEZONE = "Europe/London" diff --git a/package-lock.json b/package-lock.json index 4aa287078b..68e52ae7fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -331,9 +331,9 @@ }, "dependencies": { "tslib": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" } } }, @@ -468,9 +468,9 @@ } }, "@types/webpack-env": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@types/webpack-env/-/webpack-env-1.18.0.tgz", - "integrity": "sha512-56/MAlX5WMsPVbOg7tAxnYvNYMMWr/QJiIp6BxVSW3JJXUVzzOn64qW8TzQyMSqSUFM2+PVI4aUHcHOzIz/1tg==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/@types/webpack-env/-/webpack-env-1.18.1.tgz", + "integrity": "sha512-D0HJET2/UY6k9L6y3f5BL+IDxZmPkYmPT4+qBrRdmRLYRuV0qNKizMgTvYxXZYn+36zjPeoDZAEYBCM6XB+gww==", "dev": true }, "@types/webrtc": { @@ -705,7 +705,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" }, "prop-types": { "version": "15.8.1", @@ -1161,6 +1161,15 @@ "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", "integrity": "sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==" }, + "array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "requires": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + } + }, "array-differ": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", @@ -2367,7 +2376,7 @@ "strip-ansi": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz", - "integrity": "sha1-JfSOoiynkYfzF0pNuHWTR7sSYiA=", + "integrity": "sha512-DerhZL7j6i6/nEnVG0qViKXI0OKouvvpsAiaj7c+LfqZZZxdwZtv8+UiA/w4VUJpT8UzX0pR1dcHOii1GbmruQ==", "requires": { "ansi-regex": "^0.2.1" } @@ -2375,7 +2384,7 @@ "supports-color": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz", - "integrity": "sha1-2S3iaU6z9nMjlz1649i1W0wiGQo=" + "integrity": "sha512-tdCZ28MnM7k7cJDJc7Eq80A9CsRFAAOZUy41npOZCs++qSjfIy7o5Rh46CBk+Dk5FbKJ33X3Tqg4YrV07N5RaA==" } } }, @@ -2567,16 +2576,6 @@ "readdirp": "^2.0.0" }, "dependencies": { - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, "is-extglob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", @@ -2589,12 +2588,6 @@ "requires": { "is-extglob": "^1.0.0" } - }, - "nan": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", - "optional": true } } }, @@ -3529,43 +3522,52 @@ "integrity": "sha512-yVn6RZmHiGnxRKR9sJb3iVV2XTF1Ghh2DiWRZ3dMnGc43yUdWWF/kX6lQyk3+P84iprfWKU/8zFTrlkvtFm1ug==" }, "deep-equal": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.1.0.tgz", - "integrity": "sha512-2pxgvWu3Alv1PoWEyVg7HS8YhGlUFUV7N5oOvfL6d+7xAmLSemMwv/c8Zv/i9KFzxV5Kt5CAvQc70fLwVuf4UA==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz", + "integrity": "sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==", "requires": { + "array-buffer-byte-length": "^1.0.0", "call-bind": "^1.0.2", - "es-get-iterator": "^1.1.2", - "get-intrinsic": "^1.1.3", + "es-get-iterator": "^1.1.3", + "get-intrinsic": "^1.2.1", "is-arguments": "^1.1.1", + "is-array-buffer": "^3.0.2", "is-date-object": "^1.0.5", "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", "isarray": "^2.0.5", "object-is": "^1.1.5", "object-keys": "^1.1.1", "object.assign": "^4.1.4", - "regexp.prototype.flags": "^1.4.3", + "regexp.prototype.flags": "^1.5.0", "side-channel": "^1.0.4", "which-boxed-primitive": "^1.0.2", "which-collection": "^1.0.1", - "which-typed-array": "^1.1.8" + "which-typed-array": "^1.1.9" }, "dependencies": { "define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", "requires": { "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" } }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==" + }, "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3" } }, @@ -3617,13 +3619,13 @@ } }, "regexp.prototype.flags": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", - "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz", + "integrity": "sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==", "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "functions-have-names": "^1.2.2" + "define-properties": "^1.2.0", + "functions-have-names": "^1.2.3" } } } @@ -3963,7 +3965,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" } } }, @@ -4922,20 +4924,54 @@ "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" }, "es-get-iterator": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz", - "integrity": "sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", "requires": { "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.0", - "has-symbols": "^1.0.1", - "is-arguments": "^1.1.0", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", "is-map": "^2.0.2", "is-set": "^2.0.2", - "is-string": "^1.0.5", - "isarray": "^2.0.5" + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" }, "dependencies": { + "get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + } + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", @@ -6146,7 +6182,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" } } }, @@ -6462,6 +6498,24 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + }, + "dependencies": { + "nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "optional": true + } + } + }, "fstream": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", @@ -6989,12 +7043,13 @@ }, "dependencies": { "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3" } }, @@ -7600,9 +7655,9 @@ } }, "minimist": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.2.2.tgz", - "integrity": "sha512-g92kDfAOAszDRtHNagjZPPI/9lfOFaRBL/Ud6Z0RKZua/x+49awTydZLh5Gkhb80Xy5hmcvZNLGzscW5n5yd0g==" + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.2.4.tgz", + "integrity": "sha512-Pkrrm8NjyQ8yVt8Am9M+yUt74zE3iokhzbG1bFVNjLB92vwM71hf40RkEsryg98BujhVOncKm/C1xROxZ030LQ==" }, "readable-stream": { "version": "1.0.34", @@ -7808,6 +7863,11 @@ "get-intrinsic": "^1.1.1" } }, + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==" + }, "has-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", @@ -8792,6 +8852,34 @@ "call-bind": "^1.0.0" } }, + "is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "dependencies": { + "get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + } + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + } + } + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -9106,15 +9194,11 @@ } }, "is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" + "which-typed-array": "^1.1.11" } }, "is-typedarray": { @@ -11728,7 +11812,7 @@ "object-assign": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", - "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=" + "integrity": "sha512-jHP15vXVGeVh1HuaA2wY6lxk+whK/x4KBG88VXeRma7CCun7iGD5qPc4eYykQ9sdQvg8jkwFKsSxHln2ybW3xQ==" }, "object-component": { "version": "0.0.3", @@ -13253,7 +13337,7 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" } } }, @@ -15493,6 +15577,42 @@ } } }, + "stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "requires": { + "internal-slot": "^1.0.4" + }, + "dependencies": { + "get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + } + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "requires": { + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + } + } + }, "stream-browserify": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", @@ -15711,7 +15831,7 @@ "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", "requires": { "ansi-regex": "^2.0.0" } @@ -16278,9 +16398,9 @@ }, "dependencies": { "@types/node": { - "version": "14.18.54", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.54.tgz", - "integrity": "sha512-uq7O52wvo2Lggsx1x21tKZgqkJpvwCseBBPtX/nKQfpVlEsLOb11zZ1CRsWUKvJF0+lzuA9jwvA7Pr2Wt7i3xw==" + "version": "14.18.56", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.56.tgz", + "integrity": "sha512-+k+57NVS9opgrEn5l9c0gvD1r6C+PtyhVE4BTnMMRwiEA8ZO8uFcs6Yy2sXIy0eC95ZurBtRSvhZiHXBysbl6w==" }, "cheerio": { "version": "1.0.0-rc.12", @@ -16439,7 +16559,7 @@ "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==" }, "svgo": { "version": "0.7.2", @@ -16562,9 +16682,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -17317,7 +17437,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" } } }, @@ -18187,16 +18307,15 @@ "integrity": "sha512-F6+WgncZi/mJDrammbTuHe1q0R5hOXv/mBaiNA2TCNT/LTHusX0V+CJnj9XT8ki5ln2UZyyddDgHfCzyrOH7MQ==" }, "which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", + "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", "requires": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", "for-each": "^0.3.3", "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" + "has-tostringtag": "^1.0.0" } }, "wide-align": { diff --git a/package.json b/package.json index b6e8448e6f..6065aae965 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,7 @@ "devDependencies": { "@superdesk/build-tools": "file:build-tools", "@types/classnames": "^2.2.10", - "@types/webpack-env": "^1.17.0", + "@types/webpack-env": "^1.18.1", "@types/webrtc": "0.0.33", "enzyme": "3.9.0", "enzyme-adapter-react-16": "^1.15.5", From 41c1f7012f55aa0c583b5105ee4f2c1cd9ea0bce Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Fri, 8 Sep 2023 14:53:33 +0300 Subject: [PATCH 8/9] Multi line image caption (#4324) --- .../editor3/components/media/MediaBlock.tsx | 1 + .../PlainTextEditor/PlainTextEditor.tsx | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/core/editor3/components/media/MediaBlock.tsx b/scripts/core/editor3/components/media/MediaBlock.tsx index b88588fd81..37d0897aee 100644 --- a/scripts/core/editor3/components/media/MediaBlock.tsx +++ b/scripts/core/editor3/components/media/MediaBlock.tsx @@ -292,6 +292,7 @@ export class MediaBlockComponent extends React.Component { void; disabled?: boolean; + + // Defaults to false. + multiLine?: boolean; } interface IState { @@ -51,15 +54,17 @@ function updateStateWithValue(value: string, editorState: EditorState) { } export class PlainTextEditor extends React.Component { - spellcheckerTimeout?: number; - selection: SelectionState; + private spellcheckerTimeout?: number; + private selection: SelectionState; + private lastComputedValue: string; constructor(props) { super(props); + this.lastComputedValue = props.value?.toString() || ''; this.state = { editorState: EditorState.createWithContent( - ContentState.createFromText(props.value?.toString() || ''), + ContentState.createFromText(this.lastComputedValue), ), hasFocus: false, }; @@ -120,7 +125,9 @@ export class PlainTextEditor extends React.Component { * This version works fine and we can still handle our own selection state * */ UNSAFE_componentWillReceiveProps(props: IProps) { - this.setState({editorState: updateStateWithValue(props.value || '', this.state.editorState)}); + if (this.lastComputedValue !== props.value) { + this.setState({editorState: updateStateWithValue(props.value || '', this.state.editorState)}); + } } handleEditorChange(editorState: EditorState) { @@ -130,6 +137,7 @@ export class PlainTextEditor extends React.Component { ) { const value = editorState.getCurrentContent().getPlainText(); + this.lastComputedValue = value; this.props.onChange(value, this.props.onChangeData); } @@ -153,7 +161,7 @@ export class PlainTextEditor extends React.Component { } handleKeyCommand(command: DraftEditorCommand): DraftHandleValue { - if (command === 'split-block') { + if (command === 'split-block' && this.props.multiLine !== true) { return 'handled'; // disable Enter } From e61e84106265c3d20a65d4f727d2011e084ff078 Mon Sep 17 00:00:00 2001 From: Nikola Stojanovic <68916411+dzonidoo@users.noreply.github.com> Date: Sat, 9 Sep 2023 23:34:04 +0200 Subject: [PATCH 9/9] fix regression for SDBELGA-605 (#4223) (#4322) --- scripts/apps/users/views/edit-form.html | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/apps/users/views/edit-form.html b/scripts/apps/users/views/edit-form.html index fd709fb78f..b9b5ed26ef 100644 --- a/scripts/apps/users/views/edit-form.html +++ b/scripts/apps/users/views/edit-form.html @@ -165,6 +165,7 @@
{{ user.username}}
{{ :: 'Administrator'|translate }} {{ :: 'Author'|translate }} + {{'Private' | translate }}