Properly emit Viewer event on files and files_sharing#19777
Conversation
|
/backport to stable18 |
134cbbf to
2d6a5b0
Compare
| use OCP\Share\IManager as ShareManager; | ||
| use OCP\Template; | ||
| use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||
| use Symfony\Component\EventDispatcher\GenericEvent; |
There was a problem hiding this comment.
Replacing Symfony\Component\EventDispatcher\GenericEvent with OCP\EventDispatcher\GenericEvent breaks the apps that listen to the OCA\Files_Sharing::loadAdditionalScripts and OCA\Files_Sharing::loadAdditionalScripts::publicShareAuth events, so this API change should be documented somewhere (although there are probably not a lot of apps using those events, but still ;-) ).
There was a problem hiding this comment.
It does?
I don't understand why ? :)
There was a problem hiding this comment.
It does if types are used in the event handler, as OCP\EventDispatcher\GenericEvent does not extend Symfony\Component\EventDispatcher\GenericEvent and thus can not replace it.
I have now seen that this pull request is meant to be backported to stable18. Please keep in mind that the event type change could go in for Nextcloud 19, but it should not be merged in stable18.
There was a problem hiding this comment.
So reverting is the safest way?
Or should I just not backport the GenericEvent change?
What do you recommend here? :)
There was a problem hiding this comment.
So I can migrate to IEventDispatcher, but I should keep Symfony\Component\EventDispatcher\GenericEvent, right?
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Unfortunately you can not use IEventDispatcher either, because IEventDispatcher dispatches an OCP\EventDispatcher\Event, so it can not dispatch a Symfony\Component\EventDispatcher\GenericEvent. And as IEventDispatcher can not be used dispatchTyped can not be used either.
Similarly, dispatchTyped can not be used either in apps/files_sharing/list.php, because getEventDispatcher() returns a Symfony\Component\EventDispatcher\EventDispatcherInterface.
As EventDispatcherInterface is no longer replaced by IEventDispatcher the unit test fixes do not apply, so the commit was removed.
And finally, personally I would also drop the commit to use dispatchTyped, as it is used only once and while convenient it makes that call inconsistent with the rest of the LoadViewer dispatchers as well as with the other dispatchs in ViewCVontroller. But that is nitpicking, of course ;-) In any case, dispatchTyped was introduced in Nextcloud 18, so even if the commit is not dropped it should be safe to backport it to stable18.
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
a1a6bc1 to
3cdadeb
Compare
|
@danxuliu integration-remote-api fails
|
Although it looks highly suspicious ;-) this is not caused by this pull request (it happens on master too), but by the Behat version bump in integration tests (which causes Symfony 5 instead of Symfony 4 to be installed by composer). I will send a fix for that (in another pull request, of course ;-) ). |
|
backport to stable18 in #19897 |
Signed-off-by: John Molakvoæ (skjnldsv) skjnldsv@protonmail.com