Przeglądaj źródła

Always append "from" field when sending to HipChat

Jannik Zschiesche 10 lat temu
rodzic
commit
fa38530fdc
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      src/Monolog/Handler/HipChatHandler.php

+ 6 - 1
src/Monolog/Handler/HipChatHandler.php

@@ -141,7 +141,6 @@ class HipChatHandler extends SocketHandler
             'message' => $record['formatted'],
             'message_format' => $this->format,
             'color' => $this->getAlertColor($record['level']),
-            'from' => $this->name,
         );
 
         // if we are using the legacy API then we need to send some additional information
@@ -149,6 +148,12 @@ class HipChatHandler extends SocketHandler
             $dataArray['room_id'] = $this->room;
         }
 
+        // append the sender name if it is set
+        // always append it if we use the v1 api (it is required in v1)
+        if ($this->version == self::API_V1 || $this->name !== null) {
+            $dataArray['from'] = (string) $this->name;
+        }
+
         return http_build_query($dataArray);
     }