github.js: remove the author.

The author might not be a GitHub user, in which case we have issues like undefined author.
This commit is contained in:
XhmikosR 2013-02-28 12:53:36 +02:00 committed by Daniel Marjamäki
parent ec7843e911
commit 06c6e78be4
2 changed files with 14 additions and 9 deletions

View File

@ -9,17 +9,21 @@ jQuery.fn.listCommits = function(username, repository, branch) {
var list = $('<ul class="rssfeeditems"/>');
target.empty().append(list);
$(commits).each(function(i) {
var githubUrl = 'https://github.com/' + username + '/' + repository + '/commit/' + this.sha;
var shortMessage = cutLines(this.commit.message);
var githubUrl = 'https://github.com/' + username + '/' + repository + '/commit/' + this.sha,
shortMessage = cutLines(this.commit.message),
commitAuthor;
if (this.author !== null) {
var author = this.author.login;
}
if (author === '') {
author = this.author.name;
commitAuthor = this.author.login;
}
list.append('<li><a href="' + githubUrl + '">' + shortMessage + '</a> <em>by <strong>' + author + '</strong></em></li>');
if (commitAuthor) {
list.append('<li><a href="' + githubUrl + '">' + shortMessage + '</a> <em>by <strong>' + commitAuthor + '</strong></em></li>');
} else {
list.append('<li><a href="' + githubUrl + '">' + shortMessage + '</a></li>');
}
if (i === 9) {
return false;
@ -29,9 +33,10 @@ jQuery.fn.listCommits = function(username, repository, branch) {
function cutLines(message) {
var lineFeed = message.indexOf("\n");
if (lineFeed > -1) {
return message.slice(0, lineFeed);
}
return message;
}
};
};

File diff suppressed because one or more lines are too long