From 94367c6e5e95412ff2bcddabc19d5f6d2b92bde8 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Wed, 16 Feb 2022 08:16:01 -0800 Subject: [PATCH] Add support for emails separated by , in share screen --- packages/mindplot/src/components/MainTopic.ts | 7 ------ packages/mindplot/src/components/Topic.ts | 25 ++++++++++--------- .../src/classes/client/rest-client/index.ts | 2 +- .../action-dispatcher/share-dialog/index.tsx | 6 ++--- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/packages/mindplot/src/components/MainTopic.ts b/packages/mindplot/src/components/MainTopic.ts index c5db2dd8..e39e80db 100644 --- a/packages/mindplot/src/components/MainTopic.ts +++ b/packages/mindplot/src/components/MainTopic.ts @@ -28,12 +28,6 @@ import SizeType from './SizeType'; class MainTopic extends Topic { private INNER_RECT_ATTRIBUTES: { stroke: string; }; - /** - * @extends mindplot.Topic - * @constructs - * @param model - * @param options - */ constructor(model: NodeModel, options) { super(model, options); this.INNER_RECT_ATTRIBUTES = { stroke: '0.5 solid #009900' }; @@ -88,7 +82,6 @@ class MainTopic extends Topic { } } - /** */ disconnect(workspace: Workspace) { super.disconnect(workspace); const model = this.getModel(); diff --git a/packages/mindplot/src/components/Topic.ts b/packages/mindplot/src/components/Topic.ts index 42610289..76fd0ea2 100644 --- a/packages/mindplot/src/components/Topic.ts +++ b/packages/mindplot/src/components/Topic.ts @@ -44,6 +44,8 @@ import LayoutManager from './layout/LayoutManager'; import NoteModel from './model/NoteModel'; import LinkModel from './model/LinkModel'; import SizeType from './SizeType'; +import FeatureModel from './model/FeatureModel'; +import Icon from './Icon'; const ICON_SCALING_FACTOR = 1.3; @@ -156,7 +158,6 @@ abstract class Topic extends NodeGraph { } } - /** @return {String} topic shape type */ getShapeType(): string { const model = this.getModel(); let result = model.getShapeType(); @@ -166,7 +167,7 @@ abstract class Topic extends NodeGraph { return result; } - private _removeInnerShape() { + private _removeInnerShape(): ElementClass { const group = this.get2DElement(); const innerShape = this.getInnerShape(); group.removeChild(innerShape); @@ -303,7 +304,7 @@ abstract class Topic extends NodeGraph { return this._text; } - getOrBuildIconGroup() { + getOrBuildIconGroup(): Group { if (!$defined(this._iconsGroup)) { this._iconsGroup = this._buildIconGroup(); const group = this.get2DElement(); @@ -341,7 +342,7 @@ abstract class Topic extends NodeGraph { * @param {mindplot.model.FeatureModel} featureModel * @return {mindplot.Icon} the icon corresponding to the feature model */ - addFeature(featureModel) { + addFeature(featureModel: FeatureModel): Icon { const iconGroup = this.getOrBuildIconGroup(); this.closeEditors(); @@ -360,13 +361,13 @@ abstract class Topic extends NodeGraph { } /** */ - findFeatureById(id) { + findFeatureById(id: number) { const model = this.getModel(); return model.findFeatureById(id); } /** */ - removeFeature(featureModel) { + removeFeature(featureModel: FeatureModel): void { $assert(featureModel, 'featureModel could not be null'); // Removing the icon from MODEL @@ -382,21 +383,21 @@ abstract class Topic extends NodeGraph { } /** */ - addRelationship(relationship) { + addRelationship(relationship: Relationship) { this._relationships.push(relationship); } /** */ - deleteRelationship(relationship) { + deleteRelationship(relationship: Rect) { this._relationships = this._relationships.filter((r) => r !== relationship); } /** */ - getRelationships() { + getRelationships(): Relationship[] { return this._relationships; } - _buildTextShape(readOnly): Text { + protected _buildTextShape(readOnly: boolean): Text { const result = new Text(); const family = this.getFontFamily(); const size = this.getFontSize(); @@ -420,7 +421,7 @@ abstract class Topic extends NodeGraph { } /** */ - setFontFamily(value, updateModel) { + setFontFamily(value: string, updateModel?: boolean) { const textShape = this.getTextShape(); textShape.setFontName(value); if ($defined(updateModel) && updateModel) { @@ -431,7 +432,7 @@ abstract class Topic extends NodeGraph { } /** */ - setFontSize(value, updateModel) { + setFontSize(value: number, updateModel?: boolean) { const textShape = this.getTextShape(); textShape.setSize(value); diff --git a/packages/webapp/src/classes/client/rest-client/index.ts b/packages/webapp/src/classes/client/rest-client/index.ts index 5fdd6285..bab11c5a 100644 --- a/packages/webapp/src/classes/client/rest-client/index.ts +++ b/packages/webapp/src/classes/client/rest-client/index.ts @@ -55,7 +55,7 @@ export default class RestClient implements Client { .put( `${this.baseUrl}/c/restful/maps/${id}/collabs/`, { - messasge: message, + message: message, collaborations: permissions, }, { headers: { 'Content-Type': 'application/json' } } diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx index 09b2ded9..e6d994cd 100644 --- a/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx +++ b/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx @@ -58,9 +58,9 @@ const ShareDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement const addMutation = useMutation( (model: ShareModel) => { - const emails = model.emails.split("'"); - const permissions = emails.map((email) => { - return { email: email, role: model.role }; + const emails = model.emails.split(','); + const permissions = emails.map((email: string) => { + return { email: email.replace(/\s/g, ''), role: model.role }; }); return client.addMapPermissions(mapId, model.message, permissions); },