Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/haeli05/source into dev
Browse files Browse the repository at this point in the history
mergerino
  • Loading branch information
haeli05 committed Sep 15, 2019
2 parents 14ff752 + a2a2c8b commit 2fb7088
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 19 deletions.
4 changes: 0 additions & 4 deletions BackEnd/knexfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ module.exports = {
development: {
client: "postgresql",
connection: {
// host : process.env.PGHOST,
// user : process.env.PGUSER,
// port : process.env.PGPORT,
// database : process.env.PGDATABASE
host: process.env.PGHOST || "localhost",
user: process.env.PGUSER || "postgres",
password: process.env.PGPASS || "",
Expand Down
2 changes: 2 additions & 0 deletions BackEnd/src/db/knex.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('dotenv').config()

const environment = process.env.NODE_ENV || "development";
const config = require("../../knexfile.js")[environment];
const db = require("knex")(config);
Expand Down
2 changes: 0 additions & 2 deletions BackEnd/src/user/user.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ router.route("/user").get(UserController.getUsers);
router
.route("/user/:id")
.get(
passport.authenticate("jwt", { session: false }),
UserController.getUser
);
//Get a user by username
router.route("/user/name/:username").get(
// passport.authenticate("jwt", { session: false }),
UserController.isUserInDB
);

Expand Down
7 changes: 3 additions & 4 deletions FrontEnd/src/actions/user.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ export function addSignIn (user_data) {
token: user_data.token,
username: user_data.user.username,
email: user_data.user.email,
id: user_data.user._id,
user: user_data.user,
aws: user_data.aws
id: user_data.user.user_id,
user: user_data.user
}
}
export function addSignInStatus (status) {
Expand Down Expand Up @@ -415,7 +414,7 @@ export function inviteCodeCheck(invite){
if(!res.data.error){
return dispatch(login(
res.data.token,res.data.user.username,
res.data.user.email,res.data.user._id,res.data.user.name))
res.data.user.email,res.data.user.user_id,res.data.user.name))
}else{
console.log("error creating user",res.Data.error);
alert(res.data.error)
Expand Down
8 changes: 4 additions & 4 deletions FrontEnd/src/pages/global/components/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Comment extends React.Component {
<Card className='Comment' elevation={0}>
{!this.props.comment.deleted && (
<div className={this.getLeftClassName(this.state.minimised)}>
<Avatar component={Link} to={`/${this.props.comment.user._id}/profile`} src={this.props.comment.user.avatar} className={this.getAvatarClassName(this.state.minimised)} />
<Avatar component={Link} to={`/${this.props.comment.user.user_id}/profile`} src={this.props.comment.user.avatar} className={this.getAvatarClassName(this.state.minimised)} />
{!this.state.minimised && (
<VoteButtons id={this.props.comment._id} votes={this.props.comment.upvotes} user={this.props.user} type={this.props.type} />
)}
Expand All @@ -128,8 +128,8 @@ class Comment extends React.Component {
<div className='Right'>
{!this.props.comment.deleted && (
<div className='Header'>
<Typography variant='body1' component={Link} to={`/${this.props.comment.user._id}/profile`} className='CommentName'>{this.props.comment.user.name}</Typography>
<Typography variant='body1' component={Link} to={`/${this.props.comment.user._id}/profile`} className='CommentUsername'>@{this.props.comment.user.username}</Typography>
<Typography variant='body1' component={Link} to={`/${this.props.comment.user.user_id}/profile`} className='CommentName'>{this.props.comment.user.name}</Typography>
<Typography variant='body1' component={Link} to={`/${this.props.comment.user.user_id}/profile`} className='CommentUsername'>@{this.props.comment.user.username}</Typography>
<div className='When'>
<ReactSVG src={Simpleclock} className='ReactSVGIcon ClockIcon' />
<ReactTimeAgo locale='en' className='CommentTime'>
Expand Down Expand Up @@ -193,7 +193,7 @@ class Comment extends React.Component {
<div className='ActionButton'><ShareButton {...this.props} mini title={`${this.props.comment.user.username}'s comment on Source`} url={`${window.location.href}#${this.props.comment._id}`} /></div>
{!this.state.minimised && (
<div>
{this.props.comment.user._id === this.props.user.id && (
{this.props.comment.user.user_id === this.props.user.id && (
<div className='Flex'>
<Button variant='fab' mini className='EditButton ActionButton' onClick={this.editComment}><ReactSVG src={Edit} className='ReactSVGIcon EditIcon' /></Button>
<DeleteButton delete={this.deleteComment} mini />
Expand Down
4 changes: 2 additions & 2 deletions FrontEnd/src/pages/global/components/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class SearchResults extends Component {
})}
<Typography variant='subtitle1'>People</Typography>
{this.props.searchResults.users.map(user => {
return (<PersonCard {...this.props} content={user} key={user._id} />)
return (<PersonCard {...this.props} content={user} key={user.user_id} />)
})}
</div>
)}
Expand Down Expand Up @@ -199,7 +199,7 @@ class SearchResults extends Component {
<div className='NoResults'><Typography variant='title'>No users matched your query</Typography></div>
)}
{this.props.searchResults.users.map(user => {
return (<PersonCard {...this.props} content={user} key={user._id} />)
return (<PersonCard {...this.props} content={user} key={user.user_id} />)
})}
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/src/pages/userActions/createAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class CreateAccountPage extends Component {
}

redirect () {
this.props.history.push(`${this.props.user.user._id}/profile`)
this.props.history.push(`${this.props.user.user.user_id}/profile`)
}

render () {
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/src/pages/userActions/loginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class LoginPage extends Component {
// previous location was the landing page
if (this.props.location.state !== undefined) {
if (this.props.location.state.from === '/') {
this.props.history.push(`${this.props.user.user._id}/profile`)
this.props.history.push(`${this.props.user.user.user_id}/profile`)
} else {
this.props.history.goBack()
}
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/src/pages/welcome/welcomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class WelcomePage extends Component {
}

redirect () {
this.props.history.push(`${this.props.user.user._id}/profile`)
this.props.history.push(`${this.props.user.user.user_id}/profile`)
}

render () {
Expand Down

0 comments on commit 2fb7088

Please sign in to comment.