-
Notifications
You must be signed in to change notification settings - Fork 26
[WIP] add addSocialMediaAccount mutation #233
base: master
Are you sure you want to change the base?
Conversation
@@ -7,7 +7,7 @@ export default async (driver, authorizationHeader) => { | |||
try { | |||
const decoded = await jwt.verify(token, process.env.JWT_SECRET) | |||
id = decoded.sub | |||
} catch { | |||
} catch (e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e could also mean event, as a good practice use err or error instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I will change that, and how was that merged to master with a syntax error merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s a really good question.
@@ -56,7 +56,8 @@ const permissions = shield({ | |||
CreateBadge: isAdmin, | |||
UpdateBadge: isAdmin, | |||
DeleteBadge: isAdmin, | |||
|
|||
addSocialMediaAccount: isAuthenticated, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really social media when you can enter everything? Should we maybe limit that can be entered to prevent abuse? What do you think?
src/resolvers/user_management.js
Outdated
const [currentUser] = await result.records.map(function (record) { | ||
return record.get('user') | ||
const [currentUser] = await result.records.map(function(record) { | ||
return record.get("user") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use single quotes where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, will configure my prettier to use single quotes.
@@ -25,27 +25,54 @@ export default { | |||
|
|||
return true | |||
}, | |||
login: async (parent, { email, password }, { driver, req, user }) => { | |||
login: async (_, { email, password }, { driver, req, user }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What renaming the parent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are not using it, so I thought I could use a convention that I have seen, where the _ indicates that I'm not going to use that parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it also helps with the linter
src/schema.graphql
Outdated
@@ -12,6 +12,7 @@ type Mutation { | |||
report(id: ID!, description: String): Report | |||
disable(id: ID!): ID | |||
enable(id: ID!): ID | |||
addSocialMediaAccount(url: String!): Boolean! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s not a account using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean? change the name to addSocialMedia
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah for example. I find account on the user node a bit missleading as it might suggest third party logins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also should we maybe suggest in the name where we are adding it? For example: addUserSocialMedia
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah
fixes #/Human-Connection/Nitro-Web/issues/125