Page MenuHomeDevCentral

D897.id2280.diff
No OneTemporary

D897.id2280.diff

diff --git a/app/Http/Controllers/Gate/DockerHubGateController.php b/app/Http/Controllers/Gate/DockerHubGateController.php
--- a/app/Http/Controllers/Gate/DockerHubGateController.php
+++ b/app/Http/Controllers/Gate/DockerHubGateController.php
@@ -30,15 +30,6 @@
private $rawRequestContent;
///
- /// Constants
- ///
-
- /**
- * The name of the service this gate accepts payload from.
- */
- const SERVICE_NAME = 'DockerHub';
-
- ///
/// Request processing
///
@@ -73,6 +64,10 @@
$this->payload = json_decode($this->rawRequestContent);
}
+ public function getServiceName () : string {
+ return "DockerHub";
+ }
+
///
/// Payload processing
///
diff --git a/app/Http/Controllers/Gate/GateController.php b/app/Http/Controllers/Gate/GateController.php
--- a/app/Http/Controllers/Gate/GateController.php
+++ b/app/Http/Controllers/Gate/GateController.php
@@ -48,7 +48,7 @@
*/
protected function logRequest (array $extraContextualData = []) : void {
Log::info('[Gate] New payload.', [
- 'service' => static::SERVICE_NAME,
+ 'service' => $this->getServiceName(),
'door' => $this->door,
] + $extraContextualData);
}
@@ -62,7 +62,7 @@
*/
protected function initializeReport () : void {
if (Features::isEnabled('ActionsReport')) {
- Report::attachToGate(static::SERVICE_NAME, $this->door);
+ Report::attachToGate($this->getServiceName(), $this->door);
}
}
@@ -92,7 +92,7 @@
* @return \Nasqueron\Notifications\Config\Services\Service|null The service information is found; otherwise, null.
*/
public function getService () : ?Service {
- return Services::findServiceByDoor(static::SERVICE_NAME, $this->door);
+ return Services::findServiceByDoor($this->getServiceName(), $this->door);
}
/**
diff --git a/app/Http/Controllers/Gate/GitHubGateController.php b/app/Http/Controllers/Gate/GitHubGateController.php
--- a/app/Http/Controllers/Gate/GitHubGateController.php
+++ b/app/Http/Controllers/Gate/GitHubGateController.php
@@ -52,15 +52,6 @@
private $rawRequestContent;
///
- /// Constants
- ///
-
- /**
- * The name of the service this gate accepts payload from.
- */
- const SERVICE_NAME = 'GitHub';
-
- ///
/// Request processing
///
@@ -178,6 +169,10 @@
]);
}
+ public function getServiceName () : string {
+ return "GitHub";
+ }
+
///
/// Payload processing
///
diff --git a/app/Http/Controllers/Gate/JenkinsGateController.php b/app/Http/Controllers/Gate/JenkinsGateController.php
--- a/app/Http/Controllers/Gate/JenkinsGateController.php
+++ b/app/Http/Controllers/Gate/JenkinsGateController.php
@@ -30,15 +30,6 @@
private $rawRequestContent;
///
- /// Constants
- ///
-
- /**
- * The name of the service this gate accepts payload from.
- */
- const SERVICE_NAME = 'Jenkins';
-
- ///
/// Request processing
///
@@ -73,6 +64,10 @@
$this->payload = json_decode($this->rawRequestContent);
}
+ public function getServiceName () : string {
+ return "Jenkins";
+ }
+
///
/// Payload processing
///
diff --git a/app/Http/Controllers/Gate/PhabricatorGateController.php b/app/Http/Controllers/Gate/PhabricatorGateController.php
--- a/app/Http/Controllers/Gate/PhabricatorGateController.php
+++ b/app/Http/Controllers/Gate/PhabricatorGateController.php
@@ -23,15 +23,6 @@
private $payload;
///
- /// Constants
- ///
-
- /**
- * The name of the service this gate accepts payload from.
- */
- const SERVICE_NAME = 'Phabricator';
-
- ///
/// Requests processing
///
@@ -63,6 +54,10 @@
$this->payload = Request::all();
}
+ public function getServiceName () : string {
+ return "Phabricator";
+ }
+
///
/// Payload processing
///

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 23:48 (21 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2263169
Default Alt Text
D897.id2280.diff (3 KB)

Event Timeline