Skip to content

Commit 7b4af4b

Browse files
bug symfony#39548 [Notifier] [Infobip][Zulip] Host is required (OskarStark)
This PR was squashed before being merged into the 5.2 branch. Discussion ---------- [Notifier] [Infobip][Zulip] Host is required | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | --- | License | MIT | Doc PR | --- ### Todos after merge * [ ] adjust recipes with new DSN * [ ] update the docs Commits ------- cfd932e [Notifier] [Infobip][Zulip] Host is required
2 parents 0625c2a + cfd932e commit 7b4af4b

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

src/Symfony/Component/Notifier/Bridge/Infobip/InfobipTransport.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@ protected function doSend(MessageInterface $message): SentMessage
8686

8787
return new SentMessage($message, (string) $this);
8888
}
89+
90+
protected function getEndpoint(): ?string
91+
{
92+
return $this->host.($this->port ? ':'.$this->port : '');
93+
}
8994
}

src/Symfony/Component/Notifier/Bridge/Infobip/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
Infobip Notifier
22
================
33

4-
Provides Infobip integration for Symfony Notifier.
4+
Provides [Infobip](https://infobip.com) integration for Symfony Notifier.
55

66
DSN example
77
-----------
88

99
```
10-
INFOBIP_DSN=infobip://AUTH_TOKEN@INFOBIP_HOST?from=FROM
10+
INFOBIP_DSN=infobip://AUTH_TOKEN@HOST?from=FROM
1111
```
1212

1313
where:
1414
- `AUTH_TOKEN` is your Infobip auth token
15-
- `INFOBIP_HOST` is your Infobip host
15+
- `HOST` is your Infobip host
1616
- `FROM` is the sender
1717

1818
Resources

src/Symfony/Component/Notifier/Bridge/Mattermost/MattermostTransport.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,14 @@ protected function doSend(MessageInterface $message): SentMessage
7878

7979
$success = $response->toArray(false);
8080

81-
$sentMessage = new SentMessage($sentMessage, (string) $this);
81+
$sentMessage = new SentMessage($message, (string) $this);
8282
$sentMessage->setMessageId($success['id']);
8383

8484
return $sentMessage;
8585
}
86+
87+
protected function getEndpoint(): ?string
88+
{
89+
return $this->host.($this->port ? ':'.$this->port : '');
90+
}
8691
}

src/Symfony/Component/Notifier/Bridge/Zulip/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ DSN example
77
-----------
88

99
```
10-
ZULIP_DSN=zulip://EMAIL:TOKEN@default?channel=CHANNEL
10+
ZULIP_DSN=zulip://EMAIL:TOKEN@HOST?channel=CHANNEL
1111
```
1212

1313
where:
1414
- `EMAIL` is your Zulip email
1515
- `TOKEN` is your Zulip token
16+
- `HOST` is your Zulip host
1617
- `CHANNEL` is the channel
1718

1819
Resources

src/Symfony/Component/Notifier/Bridge/Zulip/ZulipTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ protected function doSend(MessageInterface $message): SentMessage
6363
throw new LogicException(sprintf('The "%s" transport only supports instances of "%s" for options.', __CLASS__, ZulipOptions::class));
6464
}
6565

66-
$endpoint = sprintf('https://%s/api/v1/messages', $this->getEndpoint());
67-
6866
$options = ($opts = $message->getOptions()) ? $opts->toArray() : [];
6967
$options['content'] = $message->getSubject();
7068

@@ -80,6 +78,8 @@ protected function doSend(MessageInterface $message): SentMessage
8078
$options['to'] = $message->getRecipientId();
8179
}
8280

81+
$endpoint = sprintf('https://%s/api/v1/messages', $this->getEndpoint());
82+
8383
$response = $this->client->request('POST', $endpoint, [
8484
'auth_basic' => $this->email.':'.$this->token,
8585
'body' => $options,

0 commit comments

Comments
 (0)