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:
parent
ec7843e911
commit
06c6e78be4
|
@ -9,17 +9,21 @@ jQuery.fn.listCommits = function(username, repository, branch) {
|
||||||
|
|
||||||
var list = $('<ul class="rssfeeditems"/>');
|
var list = $('<ul class="rssfeeditems"/>');
|
||||||
target.empty().append(list);
|
target.empty().append(list);
|
||||||
|
|
||||||
$(commits).each(function(i) {
|
$(commits).each(function(i) {
|
||||||
var githubUrl = 'https://github.com/' + username + '/' + repository + '/commit/' + this.sha;
|
var githubUrl = 'https://github.com/' + username + '/' + repository + '/commit/' + this.sha,
|
||||||
var shortMessage = cutLines(this.commit.message);
|
shortMessage = cutLines(this.commit.message),
|
||||||
|
commitAuthor;
|
||||||
|
|
||||||
if (this.author !== null) {
|
if (this.author !== null) {
|
||||||
var author = this.author.login;
|
commitAuthor = this.author.login;
|
||||||
}
|
|
||||||
if (author === '') {
|
|
||||||
author = this.author.name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
if (i === 9) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -29,6 +33,7 @@ jQuery.fn.listCommits = function(username, repository, branch) {
|
||||||
|
|
||||||
function cutLines(message) {
|
function cutLines(message) {
|
||||||
var lineFeed = message.indexOf("\n");
|
var lineFeed = message.indexOf("\n");
|
||||||
|
|
||||||
if (lineFeed > -1) {
|
if (lineFeed > -1) {
|
||||||
return message.slice(0, lineFeed);
|
return message.slice(0, lineFeed);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue