diff --git a/README.md b/README.md index baa01e08..7300fe15 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,8 @@ To deploy the two apps (`api` and `app`), follow the instructions below. "PRODUCTION_URL_APP": "https://your-app-url.com", "PRODUCTION_URL_API": "https://your-api-url.com", "BUCKET_FOR_POSTS": "xxxxxx", - "BUCKET_FOR_TEAM_AVATARS": "xxxxxx" + "BUCKET_FOR_TEAM_AVATARS": "xxxxxx", + "LAMBDA_API_ENDPOINT": "xxxxxx", }, "alias": "your-app-url.com", diff --git a/app/components/discussions/CreateDiscussionForm.tsx b/app/components/discussions/CreateDiscussionForm.tsx index f1ca4d7a..a9aa532a 100644 --- a/app/components/discussions/CreateDiscussionForm.tsx +++ b/app/components/discussions/CreateDiscussionForm.tsx @@ -14,7 +14,7 @@ import NProgress from 'nprogress'; import React from 'react'; import notify from '../../lib/notifier'; -import { Discussion, Post, Store } from '../../lib/store'; +import { Store } from '../../lib/store'; import PostEditor from '../posts/PostEditor'; import MemberChooser from '../users/MemberChooser'; @@ -116,22 +116,33 @@ class CreateDiscussionForm extends React.Component {


- this.setState({ content })} - members={Array.from(store.currentTeam.members.values())} - /> -

-
-

+
+ + {isMobile ?

: null} {' '} -

+

+

+ this.setState({ content })} + members={Array.from(store.currentTeam.members.values())} + /> +

+

{isMobile ?

: null} + {' '} +

+
+

@@ -180,27 +202,28 @@ class CreateDiscussionForm extends React.Component { return; } - if (!memberIds || memberIds.length < 1) { - notify('Please assign at least one person to this Discussion.'); - return; - } - + // if (!memberIds || memberIds.length < 1) { + // notify('Please assign at least one person to this Discussion.'); + // return; + // } + this.setState({ disabled: true }); NProgress.start(); - try { - this.setState({ disabled: true }); + try { const discussion = await currentTeam.addDiscussion({ name, memberIds, notificationType, }); + // await discussion.addPost(content); + const post = await discussion.addPost(content); if (discussion.notificationType === 'email') { - const userIdsForLambda = discussion.memberIds.filter(d => d !== discussion.createdUserId); - console.log(userIdsForLambda); - await discussion.sendUserIdsToLambda({ + const userIdsForLambda = discussion.memberIds.filter(m => m !== discussion.createdUserId); + console.log(discussion.notificationType, userIdsForLambda); + await discussion.sendDataToLambdaApiMethod({ discussionName: discussion.name, postContent: post.content, authorName: post.user.displayName, diff --git a/app/components/discussions/EditDiscussionForm.tsx b/app/components/discussions/EditDiscussionForm.tsx index b87afea1..c09521f3 100644 --- a/app/components/discussions/EditDiscussionForm.tsx +++ b/app/components/discussions/EditDiscussionForm.tsx @@ -157,10 +157,10 @@ class EditDiscussionForm extends React.Component { memberIds.push(discussion.store.currentUser._id); } - if (!memberIds || memberIds.length < 1) { - notify('Please assign at least one person to this Issue.'); - return; - } + // if (!memberIds || memberIds.length < 1) { + // notify('Please assign at least one person to this Issue.'); + // return; + // } if (!notificationType) { notify('Please select notification type.'); diff --git a/app/components/posts/PostForm.tsx b/app/components/posts/PostForm.tsx index 8df89a2b..8ed48415 100644 --- a/app/components/posts/PostForm.tsx +++ b/app/components/posts/PostForm.tsx @@ -115,22 +115,6 @@ class PostForm extends React.Component { />

- {readOnly ? null : ( - - - {isMobile ?

: null} - - )} {post ? (