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
Fix notifications where resources are missing #9183
Conversation
It seems like you didn't give us much information about what you're trying to do here. We would appreciate it if you could provide us with more info about this issue/PR! |
Thanks for the PR @microstudi! |
Ok, but take into account that it is extremely difficult to prevent all the situations that can leave "broken" notification. This acts as a guard clause. |
Yesterday we thought about that but we realized that this also works on other scenarios, and it'd be a bit weird for the user. For instance, what happens if you receive a notification by email, go to see it in your /notificaitons page, and can't find it? With a message at least you can see that "something" has happened. |
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
absolutely right |
Failing related spec, we'll need to change it too. Can you take it a look @microstudi? Thanks |
This should be ready @ahukkanen |
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.
👍🏽
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.
🥳
* fix notifications where resources are missing * Update decidim-core/config/locales/en.yml Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Update notification_cell_spec.rb Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
* fix notifications where resources are missing * Update decidim-core/config/locales/en.yml Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Update notification_cell_spec.rb Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> Co-authored-by: Ivan Vergés <ivan@platoniq.net>
🎩 What? Why?
It is pretty common for admins to experiments different configurations that generate notifications. For instance create a step, activate it, deactivated, delete it.
This kind of processes tend to leave some notifications to some users with orphan resources. The current cell that renders a notification does not has a guard clause to skip or show and alternative title for the notification when this happens, resulting in a frustrating 500 error that prevents access to the notification page.
This PR simply shows a message (we can change that @andreslucena) when a resource is missing for whatever reason. At least this way the user can simply discard the notification.
Testing
Create a process, create some steps in it, make sure you follow the process. Activate/deactivate some step and then delete the step. Go to notifications page, you should see a "missing event" message.
Note: this should be backported