← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~twom/lpbuildbot/better-user-display into lp:lpbuildbot

 

Tom Wardill has proposed merging lp:~twom/lpbuildbot/better-user-display into lp:lpbuildbot.

Commit message:
Add more users in a better format

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/lpbuildbot/better-user-display/+merge/397236

Add interested users to build start output.
Split users down to just their name, rather than email address.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~twom/lpbuildbot/better-user-display into lp:lpbuildbot.
=== modified file 'lpbuildbot/mattermost.py'
--- lpbuildbot/mattermost.py	2021-01-27 17:35:01 +0000
+++ lpbuildbot/mattermost.py	2021-02-01 11:18:20 +0000
@@ -25,6 +25,13 @@
             headers={"Content-type": "application/json"}
         )
 
+    def _convertUsers(self, user_list):
+        names = []
+        for user in user_list:
+            split = user_list.split(' ')[:-1]
+            names.append(' '.join(split))
+        return ', '.join(names)
+
     def builderAdded(self, builderName, builder):
         twlog.msg("Mattermost notifier: builder added")
         builder.subscribe(self)
@@ -40,17 +47,21 @@
                 "color": "#0000FF",
                 "text": "Build number {} of {} has started on {}".format(
                     build.getNumber(), builderName, build.getSlavename()),
-                "fields": [
-                    {
-                        "short": True,
-                        "title": "Revision",
-                        "value": build.getSourceStamp().revision
-                    },
-                    {
-                        "short": True,
-                        "title": "Reason",
-                        "value": build.getReason()
-                    }]
+                "fields": [{
+                    "short": False,
+                    "title": "Responsible users",
+                    "value": self._convertUsers(build.getResponsibleUsers())
+                },
+                {
+                    "short": True,
+                    "title": "Revision",
+                    "value": build.getSourceStamp().revision
+                },
+                {
+                    "short": True,
+                    "title": "Reason",
+                    "value": build.getReason()
+                }]
             }]
         }
 
@@ -73,7 +84,7 @@
                 "fields": [{
                     "short": False,
                     "title": "Responsible users",
-                    "value": build.getResponsibleUsers()
+                    "value": self._convertUsers(build.getResponsibleUsers())
                 },
                 {
                     "short": True,


Follow ups