assignToCurrentChannel
publishes ChangeChannelEvent
prematurely
#3166
Labels
assignToCurrentChannel
publishes ChangeChannelEvent
prematurely
#3166
Describe the bug
The following function inside the
ChannelService
:The function doesnt actually persist anything to the DB, it only patches the passed in object which you have to save separately. So if something goes wrong before or when saving your entity, you still publish the event which can lead to bugs if you have logic thats dependent on the
ChangeChannelEvent
as now your entity has in fact, not been assigned to a new channel. In the event itself the entity will have.channels
assigned though, so everything will look proper but be wrong.To Reproduce
ChangeChannelEvent
assignToCurrentChannel
on some entity but then fail to persist itExpected behavior
The event should only be published after actually persisting to the db. This will require a refactor of many services but keep in mind that plugins that involuntarily relied on this will be affected too.☹️
The text was updated successfully, but these errors were encountered: