-
-
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
this PR connect to this PR symfony/ux#1853 |
Co-authored-by: Oskar Stark <[email protected]>
I just noticed that |
you need this option in google chrome |
Might be the case, couldn't find any example/issue that this is the case, but why excluding other browsers and not use just a simple array to dynamically pass the possible options? My recommendation:
It also looks like the resulting activity stream doesn't fit the spec: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-announce. This might fit the spec more: {
"@context":"https://www.w3.org/ns/activitystreams",
"type":"Announce",
"summary":"subject",
"mediaType": "application/json",
"content": "{\"body\":null,\"icon\":null,\"tag\":null,\"renotify\":false}"
} |
@chapterjason it's a good idea |
@ernie76 You don't need to create new ones, just modify it, that's what PRs are about, they are evolving. I really like the initial idea, as it gives more control without creating any JS. |
add "mediaType" => "application/json" to MercureOptions.php
body
, icon
, tag
,renotify
body
, icon
, tag
,renotify
@chapterjason is this so ok now? |
$this->topics = $topics ?? 'https://symfony.com/notifier'; | ||
|
||
parent::__construct($client, $dispatcher); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return sprintf('mercure://%s%s', $this->hubId, '?'.http_build_query(['topic' => $this->topics], '', '&')); | ||
return sprintf('mercure://%s%s', $this->hubId, null !== $this->topics ? '?'.http_build_query(['topic' => $this->topics], '', '&') : ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why checking for null if constructor always sets a topic in that case?
Hey @ernie76 a bit busy the last days, only one thing, everything else looks good. 👍🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the status of this PR?
It looks like the description is a bit out of sync? Can you give it some live please?
in MercuryOptions you can now
|
what shall i do? |
What must i do, to make this to a end? |
@ernie76 can you please update the PR header? |
Co-authored-by: Oskar Stark <[email protected]>
Needs a rebase |
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a test where content is not null
as this is the goal off this PR.
i can't make a rebase. |
Sure, just close this one, create a new one, and reference this one. |
new PullRequest under |
Add content option