feat(fun/clbot): Add distinct messages for auto-submitted CLs
Detects autosubmitted CLs (other people's CLs submitted by clbot) and modifies the text submitted to IRC accordingly. If a CL is autosubmitted, we opt to highlight its author rather than invoking noping. Change-Id: Ibc21b7eeb2f0f2087097404baef6976384d68b09
This commit is contained in:
parent
fc14c21bb9
commit
7e3308df64
1 changed files with 13 additions and 2 deletions
|
@ -249,8 +249,19 @@ func main() {
|
||||||
if e.Change.Project != *notifyRepo || !notifyBranches[e.Change.Branch] {
|
if e.Change.Project != *notifyRepo || !notifyBranches[e.Change.Branch] {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
user := username(e.PatchSet)
|
owner := username(e.PatchSet)
|
||||||
parsedMsg = nopingAll(user, fmt.Sprintf("CL/%d applied by %s - %s - %s", e.Change.Number, user, e.Change.Subject, patchSetURL(e.Change, e.PatchSet)))
|
submitter := e.Submitter.Username
|
||||||
|
url := patchSetURL(e.Change, e.PatchSet)
|
||||||
|
|
||||||
|
if submitter != owner && submitter == "clbot" {
|
||||||
|
// Ping CL author on IRC for autosubmitted messages, as this
|
||||||
|
// is not necessarily an action they would otherwise notice.
|
||||||
|
// We avoid pinging only for actions triggered by the same
|
||||||
|
// user.
|
||||||
|
parsedMsg = fmt.Sprintf("CL/%d by %s autosubmitted - %s - %s", e.Change.Number, owner, e.Change.Subject, url)
|
||||||
|
} else {
|
||||||
|
parsedMsg = nopingAll(owner, fmt.Sprintf("CL/%d applied by %s - %s - %s", e.Change.Number, owner, e.Change.Subject, url))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if parsedMsg != "" {
|
if parsedMsg != "" {
|
||||||
sendMsgChan <- parsedMsg
|
sendMsgChan <- parsedMsg
|
||||||
|
|
Loading…
Reference in a new issue