-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/api 404 redirect #1837
Feature/api 404 redirect #1837
Conversation
@brylie Self assigned |
@brylie |
@brylie Sorry, looks like I have problem on my side |
} | ||
} | ||
|
||
return apiExists; |
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.
I think it can be easy:
if (api) {
return true
} else {
return false
}
And placeholder doesn't need
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.
I structured the code as such to make the linter happy. It was complaining that I had an unnecessary 'else' after a return:
@@ -19,4 +19,40 @@ Meteor.methods({ | |||
Apis.update(apiId, { $push: { authorizedUserIds: user._id } }); | |||
} | |||
}, | |||
currentUserCanViewApi (apiId) { | |||
// Placeholder for 'user is authorized' | |||
let userAuthorized; |
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.
You can also simplify this one:
// Get API
const api = Apis.findOne(apiId);
// Check if user can view
return api && api.currentUserCanView()
}, | ||
currentUserCanEditApi (apiId) { | ||
// Placeholder for 'user can edit' | ||
let userCanEdit; |
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.
And this one
// Get API
const api = Apis.findOne(apiId);
// Check if user can view
return api && api.currentUserCanEdit()
Ping @marla-singer. Changes made. |
// Check if API exists | ||
Meteor.call('checkIfApiExists', apiId, function (error, apiExists) { | ||
// Check if API exists | ||
if (apiExists === false) { |
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.
Edit this condition to
apiExists === undefined
@marla-singer I inverted the conditional, to make it easier to read and avoid the |
@brylie Nice solution 👍 Works as expected. Merge it |
Closes #1261
Changes