Fix typos
This commit is contained in:
@ -430,11 +430,13 @@ module.exports = function(User) {
|
|||||||
if (
|
if (
|
||||||
!updateData ||
|
!updateData ||
|
||||||
typeof updateData !== 'object' ||
|
typeof updateData !== 'object' ||
|
||||||
Object.keys(updateData).length > 0
|
!Object.keys(updateData).length
|
||||||
) {
|
) {
|
||||||
return Observable.throw(new Error(
|
return Observable.throw(new Error(
|
||||||
`updateData must be an object with at least on key,
|
dedent`
|
||||||
but got ${updateData}`.split('\n').join(' ')
|
updateData must be an object with at least one key,
|
||||||
|
but got ${updateData} with ${Object.keys(updateData).length}
|
||||||
|
`.split('\n').join(' ')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return this.constructor.update$({ id }, updateData, updateOptions);
|
return this.constructor.update$({ id }, updateData, updateOptions);
|
||||||
|
@ -84,7 +84,7 @@ export default function certificate(app) {
|
|||||||
|
|
||||||
function verifyCert(certType, req, res, next) {
|
function verifyCert(certType, req, res, next) {
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
return certTypeIds[certType]()
|
return certTypeIds[certType]
|
||||||
.flatMap(challenge => {
|
.flatMap(challenge => {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
@ -108,7 +108,7 @@ export default function certificate(app) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return req.user.udate$(updateData)
|
return req.user.update$(updateData)
|
||||||
// If user has commited to nonprofit,
|
// If user has commited to nonprofit,
|
||||||
// this will complete his pledge
|
// this will complete his pledge
|
||||||
.flatMap(
|
.flatMap(
|
||||||
|
@ -84,6 +84,7 @@ function buildUserUpdate(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
timezone &&
|
||||||
timezone !== 'UTC' &&
|
timezone !== 'UTC' &&
|
||||||
(!userTimezone || userTimezone === 'UTC')
|
(!userTimezone || userTimezone === 'UTC')
|
||||||
) {
|
) {
|
||||||
@ -538,16 +539,18 @@ module.exports = function(app) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const user = req.user;
|
const user = req.user;
|
||||||
return user.updateTo$(updateData)
|
const points = alreadyCompleted ?
|
||||||
.doOnNext(count => log('%s documents updated', count))
|
user.progressTimestamps.length :
|
||||||
|
user.progressTimestamps.length + 1;
|
||||||
|
return user.update$(updateData)
|
||||||
|
.doOnNext(({ count }) => log('%s documents updated', count))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
function() {
|
() => {},
|
||||||
},
|
|
||||||
next,
|
next,
|
||||||
function() {
|
function() {
|
||||||
if (type === 'json') {
|
if (type === 'json') {
|
||||||
return res.json({
|
return res.json({
|
||||||
points: user.progressTimestamps.length,
|
points,
|
||||||
alreadyCompleted
|
alreadyCompleted
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user