Skip to content

Conversation

@hgwood
Copy link
Contributor

@hgwood hgwood commented Apr 10, 2018

A first step towards GDPR compliancy (see #36).

@hgwood hgwood self-assigned this Apr 10, 2018
@hgwood hgwood requested a review from Errorname April 10, 2018 22:28
package.json Outdated
"graphcool": "^0.11.5"
}
},
"proxy": "http://192.168.99.100:60000"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woops. Shouldn't be there.

Copy link
Contributor

@Errorname Errorname left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this! This is a great first step for GDPR compliancy


export const getAllPersonalData = graphql(getAllPersonalDataQuery, {
skip: props => !auth.getUserProfile(),
options: props => ({variables: {auth0UserId: auth.getUserProfile().sub}})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of auth0UserId, you should use directly the graphcool ID. You can get it using auth.getUserNodeId()

`

export const getAllPersonalData = graphql(getAllPersonalDataQuery, {
skip: props => !auth.getUserProfile(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to skip the request because /user-profile is a PrivateRoute so it will only render if the user is authenticated

createdAt
node {
id
question {
Copy link
Contributor

@Errorname Errorname Apr 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add the attribute id of question in order to allow apollo to retrieve it from cache

createdAt
type
node {
question {
Copy link
Contributor

@Errorname Errorname Apr 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here with id of node and question

createdAt
node {
id
question {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, you need to query the id

}
})))
.reduce((all, entities) => all.concat(entities))
.sort((a, b) => a.at < b.at ? 1 : a.at > b.at ? -1 : 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a small comment on what this does would be useful for futur contributors?

{userLog.map(({type, id, at, question}) => (
<tr key={id}>
<td>{type}</td>
<td style={{whiteSpace: 'nowrap'}}>{at}</td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the moment library to format the timestamp:
moment(at).format('DD/MM/YYYY HH:MM') (See moment's documentation for more formats)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format you mention only makes sense in France. I'd rather stick with ISO 8601.

}

if (User === null) {
return <NotFound {...props} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If User === null, we should show an error instead of a 'NotFound', as this isn't a normal case


.card .card-table td {
padding: 0.5em;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure theses css rules should be in Card.css as they only help the user-profile page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I made them generic enough I think. Any table in a card will look the same.

const UserProfile = props => {
if (!props.data) {
props.history.push('/auth/login')
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need this condition if you don't skip the request (see other review comment for explanation)

<tr key={id}>
<td>{type}</td>
<td style={{whiteSpace: 'nowrap'}}>{at}</td>
<td style={{wordBreak: 'break-word'}}><Link to={question.link}>{question.title}</Link></td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to show emojis, you will need to use services/markdown and call markdown.title(question.title)

Copy link
Contributor

@Errorname Errorname left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some changes to be done to make the profile page "pretty", but it can be done is another PR

@hgwood hgwood merged commit 671a8db into master Apr 11, 2018
@hgwood hgwood deleted the gdpr-profile-page branch April 11, 2018 13:43
@hgwood hgwood mentioned this pull request Apr 11, 2018
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants