Finding areas that are untested and need love (#4131)
* Makes InstallationRouter like others * Adds testing for Range file requests - Fixes issue with small requests (0-2) * Revert "Makes InstallationRouter like others" This reverts commit e2d2a16ebf2757db6138c7b5b33c97c56c69ead6. * Better handling of errors in FilesRouter * Fix incorrectness in range requests * Better/simpler logic * Only on mongo at it requires Gridstore * Open file streaming to all adapters supporting it * Improves coverage of parsers * Ensures depreciation warning is effective * Removes unused function * de-duplicate logic * Removes necessity of overriding req.params.className on subclasses routers * Use babel-preset-env to ensure min-version compatible code * removes dead code * Leverage indexes in order to infer which field is duplicated upon signup - A note mentioned that it would be possible to leverage using the indexes on username/email to infer which is duplicated * Small nit * Better template to match column name * Restores original implementation for safety * nits
This commit is contained in:
@@ -1011,9 +1011,19 @@ RestWrite.prototype.runDatabaseOperation = function() {
|
||||
if (this.className !== '_User' || error.code !== Parse.Error.DUPLICATE_VALUE) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Quick check, if we were able to infer the duplicated field name
|
||||
if (error && error.userInfo && error.userInfo.duplicated_field === 'username') {
|
||||
throw new Parse.Error(Parse.Error.USERNAME_TAKEN, 'Account already exists for this username.');
|
||||
}
|
||||
|
||||
if (error && error.userInfo && error.userInfo.duplicated_field === 'email') {
|
||||
throw new Parse.Error(Parse.Error.EMAIL_TAKEN, 'Account already exists for this email address.');
|
||||
}
|
||||
|
||||
// If this was a failed user creation due to username or email already taken, we need to
|
||||
// check whether it was username or email and return the appropriate error.
|
||||
|
||||
// Fallback to the original method
|
||||
// TODO: See if we can later do this without additional queries by using named indexes.
|
||||
return this.config.database.find(
|
||||
this.className,
|
||||
|
||||
Reference in New Issue
Block a user