events: Fix delete/create and mention force-pushes

master
Marrub 2016-11-03 10:48:34 -04:00
parent d22641cfc4
commit 5fdfe4a910
1 changed files with 9 additions and 1 deletions

View File

@ -358,10 +358,17 @@ export default class Events
static push(info)
{
if(info.created || info.deleted)
return;
const repo = prsRepoInfo(info);
const send = prsSendInfo(info);
const name = `${repo.shortname}/${info.ref.split("/")[2]}`;
const s = info.commits.length != 1 ? "s" : "";
const parm = "";
if(info.forced)
parm = "(force pushed)";
let commits = "";
if(info.commits.length >= 10)
@ -383,7 +390,8 @@ export default class Events
sendMessage(null, [merge(true,
author(send.user, send.uri, send.avatar),
embed(`[${name}] ${info.commits.length} new commit${s}`, commits, uri)
embed(`[${name}] ${info.commits.length} new commit${s} ${parm}`,
commits, uri)
)]);
}