Skip to content

Commit 473dc3e

Browse files
committed
integrated forgot password, get invite link and fix some inconsistencies
1 parent 2e95208 commit 473dc3e

File tree

14 files changed

+317
-122
lines changed

14 files changed

+317
-122
lines changed

src/actions/orgAction.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ export const updateOrgProfile = (updatedInfo) => async (dispatch) => {
6868
if(res.status === 200) {
6969
dispatch(setRequestStatus(true))
7070
console.log('org profile updated!', res.data)
71-
dispatch({
72-
type: UPDATE_ORG_PROFILE,
73-
payload: res.data.organization
74-
})
71+
dispatch(getOrgProfile());
72+
// dispatch({
73+
// type: UPDATE_ORG_PROFILE,
74+
// payload: res.data.organization
75+
// })
7576
}
7677
} catch(error) {
7778
dispatch(errorHandler(error))

src/actions/types.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ export const GET_ADMIN = "GET_ADMIN";
3333
export const GET_COMMENTS_OF_A_POST = "GET_COMMENTS_OF_A_POST";
3434
export const GET_SINGLE_PROJECT = "GET_SINGLE_PROJECT";
3535
export const PASSWORD_CHANGE_REQUEST_SUCCESS = "PASSWORD_CHANGE_REQUEST_SUCCESS";
36-
export const PASSWORD_SUCCESSFULLY_CHANGED = "PASSWORD_SUCCESSFULLY_CHANGED";
36+
export const PASSWORD_SUCCESSFULLY_CHANGED = "PASSWORD_SUCCESSFULLY_CHANGED";
37+
export const GET_INVITE_LINK = "GET_INVITE_LINK";
38+
export const PROCESS_INVITE_LINK = "PROCESS_INVITE_LINK";

src/actions/usersAction.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GET_USER_PROFILE, GET_ALL_MEMBERS, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS } from './types'
1+
import { GET_USER_PROFILE, GET_ALL_MEMBERS, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS, GET_INVITE_LINK, PROCESS_INVITE_LINK } from './types'
22
import { errorHandler } from '../utils/errorHandler'
33
import axios from 'axios'
44
import { setRequestStatus } from '../utils/setRequestStatus'
@@ -158,3 +158,39 @@ export const getPostsCreatedByUser = (pagination = 10, page = 1) => async (dispa
158158
dispatch(errorHandler(error))
159159
}
160160
}
161+
162+
// GET INVITE LINK
163+
export const getInviteLink = () => async (dispatch) => {
164+
try {
165+
const res = await axios.get('/user/invite')
166+
dispatch(setRequestStatus(false));
167+
if(res.status === 200) {
168+
dispatch(setRequestStatus(true));
169+
console.log('Fetching invite link ', res.data.inviteLink)
170+
dispatch({
171+
type: GET_INVITE_LINK,
172+
payload: res.data.inviteLink
173+
})
174+
}
175+
} catch (error) {
176+
dispatch(errorHandler(error))
177+
}
178+
}
179+
180+
// PROCESS INVITE LINK
181+
export const processInviteToken = (token) => async (dispatch) => {
182+
try {
183+
const res = await axios.get(`/user/invite/${token}`)
184+
dispatch(setRequestStatus(false));
185+
if(res.status === 200) {
186+
dispatch(setRequestStatus(true))
187+
console.log('Processing the invite link ', res.data);
188+
dispatch({
189+
type: PROCESS_INVITE_LINK,
190+
payload: res.data.success || res.data.msg
191+
})
192+
}
193+
} catch(error) {
194+
dispatch(errorHandler(error));
195+
}
196+
}

src/reducers/userReducer.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { GET_USER_PROFILE, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS } from '../actions/types'
1+
import { GET_USER_PROFILE, UPDATE_USER_PROFILE, GET_USER_EVENTS, GET_USER_PROJECTS, GET_USER_POSTS, GET_INVITE_LINK } from '../actions/types'
22
const initialState = {
33
userProfile: {},
44
userEvents: [],
55
userProjects: [],
6-
userPosts: []
6+
userPosts: [],
7+
inviteLink: ''
78
}
89

910
export default (state = initialState, action) => {
@@ -38,6 +39,12 @@ export default (state = initialState, action) => {
3839
userProfile: action.payload
3940
}
4041
}
42+
case GET_INVITE_LINK: {
43+
return {
44+
...state,
45+
inviteLink: action.payload
46+
}
47+
}
4148
default: {
4249
return state
4350
}

src/user/dashboard/Community/components/OrgAuth.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class OrgAuth extends Component {
3333
gitlab
3434
}
3535
}
36+
console.log('updating auth settings ', info);
3637
this.props.updateSettings(info)
3738
}
3839

@@ -45,15 +46,17 @@ class OrgAuth extends Component {
4546
const { authentication } = nextProps.org.org.options;
4647
console.log("authentication ", authentication);
4748
const { email, google, github, gitlab } = authentication;
48-
this.setState({ email, google, github, gitlab }, () => {
49+
this.setState({
50+
email,
51+
google,
52+
github,
53+
gitlab,
54+
error: nextProps.error.msg
55+
}, () => {
4956
console.log("updated state", this.state);
5057
});
51-
this.setState({ error: nextProps.error.msg }, () => {
52-
console.log('state ', this.state)
53-
})
5458
}
5559

56-
5760
render() {
5861
const {
5962
email,

src/user/dashboard/Community/components/OrgPermission.js

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ class OrgPermission extends Component {
6363
const {
6464
canChangeEmail,
6565
canChangeName,
66-
// sendInvite,
67-
// canCreateManage,
66+
sendInvite,
67+
canCreateManage,
6868
// error
6969
} = this.state
7070
return (
7171
<div className="container">
7272
<div className="permission_content">
7373
<div className="container">
74-
<p className="org_permission_text">Organization Permission</p>
74+
<p className="org_permission_text">Organization Permission</p>
7575
<Form className="form">
7676
<Form.Group>
7777
<Form.Label htmlFor="header_text" className="header_text">
@@ -82,14 +82,19 @@ class OrgPermission extends Component {
8282
<Form.Label htmlFor="label_text" className="sub_header_text">
8383
Are invitations required for joining the organization?
8484
</Form.Label>
85-
<Form.Control
86-
as = "select"
87-
className = "select_option"
88-
name = "sendInvite"
85+
<Form.Control
86+
as="select"
87+
className="select_option"
88+
name="sendInvite"
89+
value={sendInvite}
8990
onChange={this.onChange}
9091
>
91-
<option value="BOTH">Yes. Admins and Members can send invitations</option>
92-
<option value="ADMINS">Yes. Only Admins can send invitations</option>
92+
<option value="BOTH">
93+
Yes. Admins and Members can send invitations
94+
</option>
95+
<option value="ADMINS">
96+
Yes. Only Admins can send invitations
97+
</option>
9398
<option value="NONE">No one can send invitations</option>
9499
</Form.Control>
95100
</Form.Group>
@@ -143,10 +148,30 @@ class OrgPermission extends Component {
143148
>
144149
Who can create and manage user groups
145150
</Form.Label>
146-
<Form.Control as="select" name="canCreateManage" className="select_option" onChange={this.onChange}>
147-
<option value="BOTH">Admins and Members </option>
148-
<option value="ADMINS">Only Admins</option>
149-
<option value="MEMBERS">Only Members </option>
151+
<Form.Control
152+
as="select"
153+
name="canCreateManage"
154+
className="select_option"
155+
onChange={this.onChange}
156+
>
157+
<option
158+
value="BOTH"
159+
selected={canCreateManage === "BOTH"}
160+
>
161+
BOTH
162+
</option>
163+
<option
164+
value="ADMINS"
165+
selected={canCreateManage === "ADMINS"}
166+
>
167+
Only Admins
168+
</option>
169+
<option
170+
value="MEMBERS"
171+
selected={canCreateManage === "MEMBERS"}
172+
>
173+
Only Members
174+
</option>
150175
</Form.Control>
151176
</Form.Group>
152177
<Form.Group>

src/user/dashboard/Community/components/OrgSettings.js

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class OrgSettings extends Component {
1313
enableEmail: true,
1414
language: "",
1515
time: "",
16-
error: ''
16+
error: '',
17+
editingTime: ''
1718
};
1819
}
1920

@@ -35,9 +36,10 @@ class OrgSettings extends Component {
3536
settings: {
3637
enableEmail,
3738
language,
38-
time
39-
}
39+
timeFormat: time
40+
},
4041
};
42+
console.log('updating settings ', info);
4143
this.props.updateSettings(info)
4244
}
4345

@@ -61,8 +63,10 @@ class OrgSettings extends Component {
6163
render() {
6264
const {
6365
enableEmail,
64-
// language,
65-
// time,
66+
language,
67+
time,
68+
editingTime,
69+
// editing
6670
// error
6771
} = this.state;
6872
return (
@@ -79,6 +83,7 @@ class OrgSettings extends Component {
7983
as="select"
8084
className="select_option"
8185
name="editing"
86+
value={editingTime}
8287
onChange={this.onChange}
8388
>
8489
<option value="10">Upto 10 min after posting</option>
@@ -145,11 +150,27 @@ class OrgSettings extends Component {
145150
as="select"
146151
name="language"
147152
className="select_option"
153+
value={language}
148154
onChange={this.onChange}
149155
>
150-
<option value="English">English</option>
151-
<option value="French">French</option>
152-
<option value="German">German</option>
156+
<option
157+
value="English"
158+
selected={language === "English"}
159+
>
160+
English
161+
</option>
162+
<option
163+
value="French"
164+
selected={language === "French"}
165+
>
166+
French
167+
</option>
168+
<option
169+
value="German"
170+
selected={language === "German"}
171+
>
172+
German
173+
</option>
153174
</Form.Control>
154175
</Form.Group>
155176
<Form.Group>
@@ -163,10 +184,19 @@ class OrgSettings extends Component {
163184
as="select"
164185
name="time"
165186
className="select_option"
187+
value={time}
166188
onChange={this.onChange}
167189
>
168-
<option value="12">12 hr clock (05:00 PM)</option>
169-
<option value="24">24 hr clock (13:00)</option>
190+
<option
191+
value="12"
192+
selected={time === "12" }
193+
>12 hr clock (05:00 PM)
194+
</option>
195+
<option
196+
value="24"
197+
selected={time === "24" }
198+
>24 hr clock (13:00)
199+
</option>
170200
</Form.Control>
171201
</Form.Group>
172202
<Form.Group>

src/user/dashboard/Community/components/permission.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
border: 0.75px solid #90949C;
1818
background: #FFFFFF;
1919
box-sizing: border-box;
20+
.hide {
21+
display: none;
22+
}
2023
}
2124
.placeholder_text {
2225
color: #C9C9C9;

src/user/dashboard/Community/components/settings.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
border: 0.75px solid #90949C;
1818
background: #FFFFFF;
1919
box-sizing: border-box;
20+
.hide {
21+
display: none;
22+
}
2023
}
2124
.placeholder_text {
2225
color: #C9C9C9;

src/user/dashboard/news-feed/popups/AddPostModal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const AddPostModal = (props) => {
6060
</Form>
6161
</Modal.Body>
6262
<div className="modal__buttons">
63-
<Button Button onClick = {createPostClick.bind(this, content)} className = "modal__save" >
63+
<Button onClick = {createPostClick.bind(this, content)} className = "modal__save" >
6464
<span className="modal__buttontext">Post</span>
6565
</Button>
6666
<Button onClick={props.onHide} className="modal__cancel">

src/user/dashboard/news-feed/popups/AddProjectModal.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const AddProjectModal = (props) => {
1010
const [long, setLongDescription] = useState("")
1111
const [githubLink, setGithubLink] = useState("")
1212
const [bitbucketLink, setBitbucketLink] = useState("")
13+
const [stacks, setTechStacks] = useState("")
1314

1415
const onProjectName = (event) => {
1516
setProjectName(event.target.value)
@@ -27,19 +28,28 @@ const AddProjectModal = (props) => {
2728
setBitbucketLink(event.target.value)
2829
}
2930

31+
const onTechStacks = (event) => {
32+
const stacks = event.target.value;
33+
console.log('stacks ', stacks);
34+
setTechStacks(stacks)
35+
}
36+
3037
const onCreateProjectClick = () => {
38+
const techStacks = stacks.split(',');
3139
const projectInfo = {
3240
projectName,
3341
description : {
3442
short,
3543
long
3644
},
45+
techStacks,
3746
links: [{ githubLink: githubLink }, {bitbucketLink: bitbucketLink}]
3847
}
3948
console.log('creating project!', projectInfo)
4049
props.createProject(projectInfo)
4150
props.handleClose()
4251
}
52+
4353
return (
4454
<Modal
4555
show={props.show}
@@ -130,6 +140,20 @@ const AddProjectModal = (props) => {
130140
/>
131141
</Form.Group>
132142
</Form.Row>
143+
<Form.Row className="modal__row">
144+
<Form.Group
145+
as={Col}
146+
controlId="formGridEmail"
147+
className="modal__group"
148+
>
149+
<Form.Label className="modal__label">Tech stacks</Form.Label>
150+
<Form.Control
151+
type="text"
152+
placeholder="Input tech stacks separated by comma.."
153+
onChange={onTechStacks}
154+
/>
155+
</Form.Group>
156+
</Form.Row>
133157
</Form>
134158
</Modal.Body>
135159
<div className="modal__buttons">

0 commit comments

Comments
 (0)