Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit e0d0b35

Browse files
committed
Merge pull request #432 from appirio-tech/dev
Release dev to qa
2 parents b038b9d + 9c1161f commit e0d0b35

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

actions/challengeRegistration.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,9 +869,12 @@ exports.registerChallenge = {
869869
if (error) {
870870
console.log("error: " + error);
871871
cb(error);
872-
} else {
873-
console.log("error11: " + error);
874-
api.dataAccess.executeQuery('check_challenge_exists', {challengeId: challengeId}, connection.dbConnectionMap, cb);
872+
} else {
873+
api.helper.checkUserActivated(connection.caller.handle, api, connection.dbConnectionMap, function (err, inactive) {
874+
var fail = err || inactive;
875+
if (fail) cb(fail);
876+
else api.dataAccess.executeQuery('check_challenge_exists', {challengeId: challengeId}, connection.dbConnectionMap, cb);
877+
}, "You must activate your account in order to participate. Please check your e-mail in order to complete the activation process, or contact support@topcoder.com if you did not receive an e-mail.");
875878
}
876879
}, function (result, cb) {
877880
if (result.length > 0) {

apiary.apib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9946,7 +9946,7 @@ Request
99469946
}
99479947

99489948
## Register for a software/studio challenge [/challenges/{challengeId}/register]
9949-
### Register for a software/studio challenge [GET]
9949+
### Register for a software/studio challenge [POST]
99509950

99519951
+ Parameters
99529952
+ challengeId (required, number, `1234567`) ... The challenge for which to register

initializers/helper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ helper.checkUserExists = function (handle, api, dbConnectionMap, callback) {
16251625
* @param {Object} dbConnectionMap - the database connection map
16261626
* @param {Function<err>} callback - the callback function
16271627
*/
1628-
helper.checkUserActivated = function (handle, api, dbConnectionMap, callback) {
1628+
helper.checkUserActivated = function (handle, api, dbConnectionMap, callback, textResponse) {
16291629
api.dataAccess.executeQuery('check_user_activated', { handle: handle }, dbConnectionMap, function (err, result) {
16301630
if (err) {
16311631
callback(err, null);
@@ -1634,7 +1634,8 @@ helper.checkUserActivated = function (handle, api, dbConnectionMap, callback) {
16341634
if (result && result[0] && result[0].status === 'A') {
16351635
callback(err, null);
16361636
} else {
1637-
callback(err, new BadRequestError('User is not activated.'));
1637+
var message = textResponse || 'User is not activated.';
1638+
callback(err, new BadRequestError(message));
16381639
}
16391640
});
16401641
};

0 commit comments

Comments
 (0)