Events.push: Make long commit lists omit better
parent
e7cd2a7334
commit
d22641cfc4
|
@ -182,6 +182,15 @@ function issueInfo(info, issu)
|
||||||
return outp;
|
return outp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function commitMsg(repo, commit)
|
||||||
|
{
|
||||||
|
const shorthash = commit.id.substring(0, 7);
|
||||||
|
const uri = struri(`${repo.uri}/commit/${commit.id}`);
|
||||||
|
const msg = esc(clipstr(commit.message.split(/\r?\n/)[0], 64));
|
||||||
|
const name = esc(commit.author.name);
|
||||||
|
return `${uristr(`\`${shorthash}\``, uri)} ${msg} - *${name}*\n`;
|
||||||
|
}
|
||||||
|
|
||||||
export default class Events
|
export default class Events
|
||||||
{
|
{
|
||||||
static commit_comment(info)
|
static commit_comment(info)
|
||||||
|
@ -355,14 +364,20 @@ export default class Events
|
||||||
const s = info.commits.length != 1 ? "s" : "";
|
const s = info.commits.length != 1 ? "s" : "";
|
||||||
|
|
||||||
let commits = "";
|
let commits = "";
|
||||||
for (let commit of info.commits) {
|
if(info.commits.length >= 10)
|
||||||
if(commits.length > 1000) break;
|
{
|
||||||
const shorthash = commit.id.substring(0, 7);
|
let omitted = info.commits.length - 8;
|
||||||
const uri = struri(`${repo.uri}/commit/${commit.id}`);
|
|
||||||
const msg = esc(clipstr(commit.message.split(/\r?\n/)[0], 64));
|
for(let i = 0; i < 4; i++)
|
||||||
const name = esc(commit.author.name);
|
commits += commitMsg(repo, info.commits[i]);
|
||||||
commits += `${uristr(`\`${shorthash}\``, uri)} ${msg} - *${name}*\n`;
|
|
||||||
|
commits += `(*${omitted} more commits*)\n`;
|
||||||
|
|
||||||
|
for(let i = omitted + 4; i < info.commits.length; i++)
|
||||||
|
commits += commitMsg(repo, info.commits[i]);
|
||||||
}
|
}
|
||||||
|
else for(let i = 0; i < info.commits.length; i++)
|
||||||
|
commits += commitMsg(repo, info.commits[i]);
|
||||||
|
|
||||||
const uri = info.compare;
|
const uri = info.compare;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue