-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] [Mercure] Add options #54961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3e816ff
6c7428a
7ed8d75
265f00e
9d05e77
c830aed
651a89f
b5eeda6
f5f1526
52f41ec
5fc0ac5
4a66651
182f5a9
9095164
0c2e231
e0c1a9a
89d13ba
ac83946
30958e8
c3554d2
d27eaf2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
CHANGELOG | ||
========= | ||
|
||
7.3 | ||
--- | ||
|
||
* Add `content` option | ||
|
||
5.3 | ||
--- | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,8 @@ protected function doSend(MessageInterface $message): SentMessage | |
'@context' => 'https://www.w3.org/ns/activitystreams', | ||
'type' => 'Announce', | ||
'summary' => $message->getSubject(), | ||
'mediaType' => 'application/json', | ||
'content' => $options->getContent(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make it fit correctly it should be serialized to json here. (Only the value of the content entry) For now I think it is enough to just inject the Serializer and always encode to json. To keep this PR simple. I would also add an test to cover this case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ernie76 What about this comment? |
||
]), $options->isPrivate(), $options->getId(), $options->getType(), $options->getRetry()); | ||
|
||
try { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,7 @@ public function testSendWithMercureOptions() | |
{ | ||
$hub = new MockHub('https://foo.com/.well-known/mercure', new StaticTokenProvider('foo'), function (Update $update): string { | ||
$this->assertSame(['/topic/1', '/topic/2'], $update->getTopics()); | ||
$this->assertSame('{"@context":"https:\/\/www.w3.org\/ns\/activitystreams","type":"Announce","summary":"subject"}', $update->getData()); | ||
$this->assertSame('{"@context":"https:\/\/www.w3.org\/ns\/activitystreams","type":"Announce","summary":"subject","mediaType":"application\/json","content":null}', $update->getData()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should add a test where content is not |
||
$this->assertSame('id', $update->getId()); | ||
$this->assertSame('type', $update->getType()); | ||
$this->assertSame(1, $update->getRetry()); | ||
|
@@ -130,7 +130,7 @@ public function testSendWithMercureOptionsButWithoutOptionTopic() | |
{ | ||
$hub = new MockHub('https://foo.com/.well-known/mercure', new StaticTokenProvider('foo'), function (Update $update): string { | ||
$this->assertSame(['https://symfony.com/notifier'], $update->getTopics()); | ||
$this->assertSame('{"@context":"https:\/\/www.w3.org\/ns\/activitystreams","type":"Announce","summary":"subject"}', $update->getData()); | ||
$this->assertSame('{"@context":"https:\/\/www.w3.org\/ns\/activitystreams","type":"Announce","summary":"subject","mediaType":"application\/json","content":null}', $update->getData()); | ||
$this->assertSame('id', $update->getId()); | ||
$this->assertSame('type', $update->getType()); | ||
$this->assertSame(1, $update->getRetry()); | ||
|
@@ -146,7 +146,7 @@ public function testSendWithoutMercureOptions() | |
{ | ||
$hub = new MockHub('https://foo.com/.well-known/mercure', new StaticTokenProvider('foo'), function (Update $update): string { | ||
$this->assertSame(['https://symfony.com/notifier'], $update->getTopics()); | ||
$this->assertSame('{"@context":"https:\/\/www.w3.org\/ns\/activitystreams","type":"Announce","summary":"subject"}', $update->getData()); | ||
$this->assertSame('{"@context":"https:\/\/www.w3.org\/ns\/activitystreams","type":"Announce","summary":"subject","mediaType":"application\/json","content":null}', $update->getData()); | ||
$this->assertFalse($update->isPrivate()); | ||
|
||
return 'id'; | ||
|
Uh oh!
There was an error while loading. Please reload this page.