mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
db/AuthorManager: use jshint
This commit is contained in:
parent
2584f023d2
commit
a505503e2f
1 changed files with 33 additions and 31 deletions
|
@ -31,9 +31,9 @@ exports.doesAuthorExists = function (authorID, callback)
|
|||
db.get("globalAuthor:" + authorID, function (err, author)
|
||||
{
|
||||
if(ERR(err, callback)) return;
|
||||
callback(null, author != null);
|
||||
callback(null, author ? true : false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the AuthorID for a token.
|
||||
|
@ -48,7 +48,7 @@ exports.getAuthor4Token = function (token, callback)
|
|||
//return only the sub value authorID
|
||||
callback(null, author ? author.authorID : author);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the AuthorID for a mapper.
|
||||
|
@ -63,12 +63,14 @@ exports.createAuthorIfNotExistsFor = function (authorMapper, name, callback)
|
|||
|
||||
//set the name of this author
|
||||
if(name)
|
||||
{
|
||||
exports.setAuthorName(author.authorID, name);
|
||||
}
|
||||
|
||||
//return the authorID
|
||||
callback(null, author);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the AuthorID for a mapper. We can map using a mapperkey,
|
||||
|
@ -85,7 +87,7 @@ function mapAuthorWithDBKey (mapperkey, mapper, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
|
||||
//there is no author with this mapper, so create one
|
||||
if(author == null)
|
||||
if(!author)
|
||||
{
|
||||
exports.createAuthor(null, function(err, author)
|
||||
{
|
||||
|
@ -126,7 +128,7 @@ exports.createAuthor = function(name, callback)
|
|||
db.set("globalAuthor:" + author, authorObj);
|
||||
|
||||
callback(null, {authorID: author});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the Author Obj of the author
|
||||
|
@ -136,7 +138,7 @@ exports.createAuthor = function(name, callback)
|
|||
exports.getAuthor = function (author, callback)
|
||||
{
|
||||
db.get("globalAuthor:" + author, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the color Id of the author
|
||||
|
@ -146,7 +148,7 @@ exports.getAuthor = function (author, callback)
|
|||
exports.getAuthorColorId = function (author, callback)
|
||||
{
|
||||
db.getSub("globalAuthor:" + author, ["colorId"], callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the color Id of the author
|
||||
|
@ -156,7 +158,7 @@ exports.getAuthorColorId = function (author, callback)
|
|||
exports.setAuthorColorId = function (author, colorId, callback)
|
||||
{
|
||||
db.setSub("globalAuthor:" + author, ["colorId"], colorId, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the name of the author
|
||||
|
@ -166,7 +168,7 @@ exports.setAuthorColorId = function (author, colorId, callback)
|
|||
exports.getAuthorName = function (author, callback)
|
||||
{
|
||||
db.getSub("globalAuthor:" + author, ["name"], callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the name of the author
|
||||
|
@ -176,7 +178,7 @@ exports.getAuthorName = function (author, callback)
|
|||
exports.setAuthorName = function (author, name, callback)
|
||||
{
|
||||
db.setSub("globalAuthor:" + author, ["name"], name, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates a random String with the given length. Is needed to generate the Author Ids
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue