Fix for old challenge names in account view so linking still works.
This commit is contained in:
@@ -147,10 +147,12 @@ exports.returnCurrentChallenge = function(req, res, next) {
|
|||||||
exports.returnIndividualChallenge = function(req, res, next) {
|
exports.returnIndividualChallenge = function(req, res, next) {
|
||||||
var dashedName = req.params.challengeName;
|
var dashedName = req.params.challengeName;
|
||||||
|
|
||||||
var challengeName = dashedName.replace(/\-/g, ' ')
|
var challengeName = /^(bonfire|waypoint)/.test(dashedName) ? dashedName
|
||||||
.split(' ')
|
.replace(/\-/g, ' ')
|
||||||
.slice(1)
|
.split(' ')
|
||||||
.join(' ');
|
.slice(1)
|
||||||
|
.join(' ')
|
||||||
|
: dashedName;
|
||||||
|
|
||||||
Challenge.find({'name': new RegExp(challengeName, 'i')},
|
Challenge.find({'name': new RegExp(challengeName, 'i')},
|
||||||
function(err, challengeFromMongo) {
|
function(err, challengeFromMongo) {
|
||||||
|
Reference in New Issue
Block a user