about summary refs log tree commit diff
path: root/fun
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-12-10T13·19+0300
committerclbot <clbot@tvl.fyi>2021-12-10T13·50+0000
commit2fc64dc277ffad05737ff6a0094cf656c9f73bae (patch)
tree80cc3a4ea6da69db29e4dc1ff26b1e0742e72646 /fun
parentbc3d35f3d0ecffd0b02cc7a7ddea12ae2c63c075 (diff)
fix(clbot): Use change *owner* and not *uploader* r/3186
In autosubmit cases that require rebases, the change *uploader* might
be clbot which would cause besadii to use clbot as the owner.

This is incorrect, but luckily the change-merged event has an actual
owner field instead.

Change-Id: Ia35b52085f94628e61eb358807b3b85565521b60
Diffstat (limited to 'fun')
-rw-r--r--fun/clbot/clbot.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/fun/clbot/clbot.go b/fun/clbot/clbot.go
index 317d99e22f05..ee250f706c8c 100644
--- a/fun/clbot/clbot.go
+++ b/fun/clbot/clbot.go
@@ -156,11 +156,11 @@ func runIRC(ctx context.Context, ircCfg irc.ClientConfig, sendMsg <-chan string)
 	}
 }
 
-func username(p gerritevents.PatchSet) string {
+func username(a gerritevents.Account) string {
 	options := []string{
-		p.Uploader.Username,
-		p.Uploader.Name,
-		p.Uploader.Email,
+		a.Username,
+		a.Name,
+		a.Email,
 	}
 	for _, opt := range options {
 		if opt != "" {
@@ -243,13 +243,13 @@ func main() {
 				if e.Change.Project != *notifyRepo || !notifyBranches[e.Change.Branch] || e.PatchSet.Number != 1 {
 					continue
 				}
-				user := username(e.PatchSet)
+				user := username(e.PatchSet.Uploader)
 				parsedMsg = nopingAll(user, fmt.Sprintf("CL/%d proposed by %s - %s - %s", e.Change.Number, user, e.Change.Subject, patchSetURL(e.Change, e.PatchSet)))
 			case *gerritevents.ChangeMerged:
 				if e.Change.Project != *notifyRepo || !notifyBranches[e.Change.Branch] {
 					continue
 				}
-				owner := username(e.PatchSet)
+				owner := username(e.Change.Owner)
 				submitter := e.Submitter.Username
 				url := patchSetURL(e.Change, e.PatchSet)