Check at least if url is a guid, better to check if model exists but

that's not working
This commit is contained in:
Tyler Renelle 2012-07-11 20:14:29 -04:00
parent 2fa58da27e
commit 2620b25ffb
2 changed files with 7 additions and 4 deletions

View file

@ -77,9 +77,10 @@ view.fn("silver", function(num) {
});
get('/:userId?', function(page, model, _arg) {
var userId;
var debuggingUsers, userId;
userId = _arg.userId;
if (userId != null) {
debuggingUsers = parseInt(userId) < 40;
if ((userId != null) && (Guid.isGuid(userId) || debuggingUsers)) {
model.set('_session.userId', userId);
return getRoom(page, model, userId);
}

View file

@ -49,8 +49,10 @@ get '/:userId?', (page, model, {userId}) ->
# Saved session
# TODO: this doesn't check that the user at guid exists, and
# will probably error since no user is created. Will only happen if
# first access, but still
if userId?# and model.get(userId)?
# first access, but still. model.get(userId) and model.get("users.#{userId}") aren't
# working for some reason
debuggingUsers = (parseInt(userId) < 40) #these are users created before guid was in use, need to convert them to guid and get rid of this
if userId? and (Guid.isGuid(userId) or debuggingUsers)# and model.get(userId)?
model.set '_session.userId', userId
return getRoom page, model, userId