-
-
Notifications
You must be signed in to change notification settings - Fork 408
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 broken dashboard action logs under certain conditions #6857
Fix broken dashboard action logs under certain conditions #6857
Conversation
Before the autoloader could confuse the admin log presenters with the normal presenters. This is an attempt to try to avoid this issue.
@@ -5,7 +5,7 @@ | |||
module Decidim | |||
module Assemblies | |||
module AdminLog | |||
describe AssembliesTypePresenter, type: :helper do | |||
describe AdminLog::AssembliesTypePresenter, type: :helper do |
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.
Maybe it's better to simply specify the whole class & module names?
describe Decidim::Assemblies::AdminLog::AssembliesTypePresenter do
Same for the rest of the files
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.
@mrcasals At some point I got Rubocop violation for doing that but I'm not sure if the rules have changed.
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.
@mrcasals I tried to change it like this and this is what I get:
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.
That's weird, because we have specs similar to what you post:
Line 5 in d113f06
describe Decidim::Assemblies::AdminLog::ValueTypes::MemberPositionPresenter, type: :helper do |
Maybe your Rubocop is not getting the Decidim config for some reason?
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.
No, it's using the correct config. Other cops work totally fine.
It seems to be an issue with the VSCode extension:
rubyide/vscode-ruby#625
Althrough I don't know where it's coming from because what that extension is doing is running the same rubocop that I can run on the command line...
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.
@mrcasals It's now changed as you proposed.
I assume the issue is in rubocop-rspec, I reported it here with further details:
rubocop/rubocop-rspec#1091
The result of that cop depends where rubocop is run from which doesn't seem right to me. The CI runs it in the root of the project when it works correctly. The VSCode extension runs it in the same folder where the file is located at when it does not work.
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.
Ah, nice catch, thanks!!
Apart from that comment, thank you very much for those PRs, @ahukkanen! Clear, to the point and easy to understand what's going on! As an ex-member of the Core team, I find this kind of PRs super helpful and easy for reviewers 😃 Thanks! |
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.
Great job @ahukkanen!
* Fix broken dashboard action logs and add specs * Avoid autoload conflicts with the admin log presenter tests Before the autoloader could confuse the admin log presenters with the normal presenters. This is an attempt to try to avoid this issue. * Clarify the admin log presenter shared example context name * Fix invalid namespace with meetings admin log spec * Change the namespacing convention in the specs * Fix return type comment
) * Fix broken dashboard action logs and add specs * Avoid autoload conflicts with the admin log presenter tests Before the autoloader could confuse the admin log presenters with the normal presenters. This is an attempt to try to avoid this issue. * Clarify the admin log presenter shared example context name * Fix invalid namespace with meetings admin log spec * Change the namespacing convention in the specs * Fix return type comment
…ngs_content_block * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…_content_block * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…cipatory_processes_content_block * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…link * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…ighted_groups * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…s_and_processes_block * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
🎩 What? Why?
There is a programming mistake in most action log presenters that can cause the action log views to break when the version record is not available (for one reason or another) and the diff is set to be shown.
If you take a look at the
has_diff?
method in the BasePresenter, it tries to assume that the action log version record is always available in order to show its changeset:decidim/decidim-core/app/presenters/decidim/log/base_presenter.rb
Lines 201 to 203 in 30abdf5
However, this check is bypassed by most of the action log record specific presenters, such as the proposal presenter as you can see here:
decidim/decidim-proposals/app/presenters/decidim/proposals/admin_log/proposal_presenter.rb
Lines 45 to 47 in 30abdf5
So, if for one reason or another, the action log's version record is not set properly, is deleted, etc. the dashboard index page and the action logs page could be totally broken.
Of course, this does not happen under "normal" and "stable" conditions when everything has been stored normally but it is certainly possible that the version record is not always available for the action log.
This ensures this is always the case and adds a shared example spec which is applied to all of these records that may have had this problem before. If you run those tests against the current core, they would fail.
The exception that you may see in the application logs should look something like this:
Show stacktrace
Testing
Decidim::ActionLog.last.update!(version_id: nil)
📋 Checklist
docs/
.