Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
ernie76 wants to merge21 commits intosymfony:7.3fromernie76:NotifierMercure

Conversation

ernie76
Copy link
Contributor

@ernie76ernie76 commentedMay 17, 2024
edited by OskarStark
Loading

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
LicenseMIT

Add content option

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.1 branch.

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!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@xabbuhxabbuh modified the milestones:7.1,7.2May 17, 2024
@ernie76
Copy link
ContributorAuthor

this PR connect to this PRsymfony/ux#1853

@ernie76ernie76 changed the titleNotifier mercure[Notifier] mercure add body, icon, tag ,renotifyMay 17, 2024
@OskarStarkOskarStark changed the title[Notifier] mercure add body, icon, tag ,renotify[Notifier][Mercure] Add body, icon, tag ,renotifyMay 21, 2024
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
@chapterjason
Copy link
Contributor

chapterjason commentedMay 21, 2024
edited
Loading

I just noticed thatrenotify is not supported in Firefox and Safari according todeveloper.mozilla.org; and there seem to be more properties than just those 4.

@ernie76
Copy link
ContributorAuthor

I just noticed thatrenotify is not supported in Firefox and Safari according todeveloper.mozilla.org; and there seem to be more properties than just those 4.

you need this option in google chrome

@chapterjason
Copy link
Contributor

chapterjason commentedMay 21, 2024
edited
Loading

I just noticed thatrenotify is not supported in Firefox and Safari according todeveloper.mozilla.org; and there seem to be more properties than just those 4.

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:

  • Replace args for the options with an array
  • Add type doc with a reference to developer.mozilla.org, optionally define array shape
  • Just pass the array (Also reduces the named arguments and multiple JSON.parse calls in ux package)

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}"}

@ernie76
Copy link
ContributorAuthor

@chapterjason it's a good idea
i close this PR and the PR on the ux side, and try it again.
is this ok?

@chapterjason
Copy link
Contributor

@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.

Sven Scholz added2 commitsMay 22, 2024 10:23
@OskarStarkOskarStark changed the title[Notifier][Mercure] Add body, icon, tag ,renotify[Notifier][Mercure] Addbody,icon,tag ,renotifyMay 22, 2024
@ernie76ernie76 changed the title[Notifier][Mercure] Addbody,icon,tag ,renotify[Notifier][Mercure] Add optionsMay 22, 2024
@ernie76
Copy link
ContributorAuthor

@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], '', '&') : '');
Copy link
Contributor

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?

@chapterjason
Copy link
Contributor

Hey@ernie76 a bit busy the last days, only one thing, everything else looks good. 👍🏼

@carsonbotcarsonbot changed the title[Mercure] Add options[Notifier] [Mercure] Add optionsMay 29, 2024
@ernie76ernie76 requested a review fromOskarStarkJune 15, 2024 16:53
Copy link
Member

@nicolas-grekasnicolas-grekas left a 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?

@ernie76
Copy link
ContributorAuthor

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
pass an array with the protertieshttps://developer.mozilla.org/en-US/docs/Web/API/Notification?retiredLocale=de#instance_properties

        new MercureOptions(['https://example.com/books/1'], content: ['tag' => $randonnumber,'body' => 'TEST', 'icon' =>  'https://media.flaticon.com/dist/min/img/logos/flaticon-color-negative.svg'])

@ernie76
Copy link
ContributorAuthor

what shall i do?

@ernie76
Copy link
ContributorAuthor

What must i do, to make this to a end?

@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@OskarStark
Copy link
Contributor

@ernie76 can you please update the PR header?

Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
@OskarStarkOskarStark requested review fromdunglas and removed request forchapterjasonApril 2, 2025 07:06
@OskarStark
Copy link
Contributor

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());
Copy link
Member

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 notnull as this is the goal off this PR.

OskarStark and chapterjason reacted with thumbs up emoji
@ernie76
Copy link
ContributorAuthor

i can't make a rebase.
can i make a new pullrequest?
i have all changes done.

@fabpot
Copy link
Member

i can't make a rebase. can i make a new pullrequest? i have all changes done.

Sure, just close this one, create a new one, and reference this one.

@ernie76
Copy link
ContributorAuthor

new PullRequest under
#60140

@ernie76ernie76 closed thisApr 4, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@norkunasnorkunasnorkunas left review comments

@fabpotfabpotfabpot requested changes

@chapterjasonchapterjasonchapterjason requested changes

@OskarStarkOskarStarkOskarStark approved these changes

@dunglasdunglasAwaiting requested review from dunglas

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

8 participants
@ernie76@carsonbot@chapterjason@OskarStark@fabpot@nicolas-grekas@norkunas@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp