From a830ddd0a966d0cba7e924fe4510a3791d8a70cb Mon Sep 17 00:00:00 2001 From: Adrien Dessy Date: Mon, 10 Jun 2024 15:46:57 +0200 Subject: [PATCH 1/2] [TAN-1930] Log reports that could not be republished Instead of making the transaction fail, we now log the error when a report can't be republished. This can occur if the report references a project, phase, or other resource that has been deleted. --- ...isitor_timeline_widgets_craftjs_state.rake | 34 ++++++++++++------- ...grate_deprecated_custom_field_widgets.rake | 34 ++++++++++++------- ...rate_deprecated_participation_widgets.rake | 34 ++++++++++++------- 3 files changed, 66 insertions(+), 36 deletions(-) diff --git a/back/lib/tasks/single_use/20240530_migrate_visitor_timeline_widgets_craftjs_state.rake b/back/lib/tasks/single_use/20240530_migrate_visitor_timeline_widgets_craftjs_state.rake index 537dd66937a5..55d4f115328e 100644 --- a/back/lib/tasks/single_use/20240530_migrate_visitor_timeline_widgets_craftjs_state.rake +++ b/back/lib/tasks/single_use/20240530_migrate_visitor_timeline_widgets_craftjs_state.rake @@ -19,14 +19,24 @@ namespace :single_use do layout.save! if layout.content_buildable_type == 'ReportBuilder::Report' - report = layout.content_buildable - user = report.owner || User.super_admins.first || User.admins.first - ReportBuilder::ReportPublisher.new(report, user).publish + # Refresh the report data + republish_report(layout.content_buildable) end end end end + def republish_report(report) + user = report.owner || User.super_admins.first || User.admins.first + ReportBuilder::ReportPublisher.new(report, user).publish + rescue ActiveRecord::RecordNotFound => e + Rails.logger.error( + message: 'Cannot refresh report data', + exception: e, + report_id: report.id + ) + end + # endregion HELPER METHODS Tenant.prioritize(Tenant.creation_finalized).each do |tenant| @@ -36,15 +46,15 @@ namespace :single_use do .with_widget_type('VisitorsWidget') .preload(content_buildable: :owner) - layouts.each do |layout| - Rails.logger.info( - 'migrate_visitor_timeline_widgets_craftjs_state', - tenant_id: tenant.id, - tenant_host: tenant.host, - layout_id: layout.id - ) - - migrate_layout(layout) + Rails.logger.tagged( + task: 'migrate_visitor_timeline_widgets_craftjs_state', + tenant_id: tenant.id, + tenant_host: tenant.host + ) do + layouts.each do |layout| + Rails.logger.info('Layout migration', layout_id: layout.id) + migrate_layout(layout) + end end end end diff --git a/back/lib/tasks/single_use/20240601_migrate_deprecated_custom_field_widgets.rake b/back/lib/tasks/single_use/20240601_migrate_deprecated_custom_field_widgets.rake index 7925901fda19..12924d845179 100644 --- a/back/lib/tasks/single_use/20240601_migrate_deprecated_custom_field_widgets.rake +++ b/back/lib/tasks/single_use/20240601_migrate_deprecated_custom_field_widgets.rake @@ -27,13 +27,23 @@ namespace :single_use do layout.save! if layout.content_buildable_type == 'ReportBuilder::Report' - report = layout.content_buildable - user = report.owner || User.super_admins.first || User.admins.first - ReportBuilder::ReportPublisher.new(report, user).publish + # Refresh the report data + republish_report(layout.content_buildable) end end end + def republish_report(report) + user = report.owner || User.super_admins.first || User.admins.first + ReportBuilder::ReportPublisher.new(report, user).publish + rescue ActiveRecord::RecordNotFound => e + Rails.logger.error( + message: 'Cannot refresh report data', + exception: e, + report_id: report.id + ) + end + # endregion HELPER METHODS Tenant.prioritize(Tenant.creation_finalized).each do |tenant| @@ -43,15 +53,15 @@ namespace :single_use do .with_widget_type('GenderWidget', 'AgeWidget') .preload(content_buildable: :owner) - layouts.each do |layout| - Rails.logger.info( - 'migrate_deprecated_custom_field_widgets', - tenant_id: tenant.id, - tenant_host: tenant.host, - layout_id: layout.id - ) - - migrate_layout(layout) + Rails.logger.tagged( + task: 'migrate_deprecated_custom_field_widgets', + tenant_id: tenant.id, + tenant_host: tenant.host + ) do + layouts.each do |layout| + Rails.logger.info('Layout migration', layout_id: layout.id) + migrate_layout(layout) + end end end end diff --git a/back/lib/tasks/single_use/20240601_migrate_deprecated_participation_widgets.rake b/back/lib/tasks/single_use/20240601_migrate_deprecated_participation_widgets.rake index 56f65c76193d..c0f0fc4d403c 100644 --- a/back/lib/tasks/single_use/20240601_migrate_deprecated_participation_widgets.rake +++ b/back/lib/tasks/single_use/20240601_migrate_deprecated_participation_widgets.rake @@ -30,13 +30,23 @@ namespace :single_use do layout.save! if layout.content_buildable_type == 'ReportBuilder::Report' - report = layout.content_buildable - user = report.owner || User.super_admins.first || User.admins.first - ReportBuilder::ReportPublisher.new(report, user).publish + # Refresh the report data + republish_report(layout.content_buildable) end end end + def republish_report(report) + user = report.owner || User.super_admins.first || User.admins.first + ReportBuilder::ReportPublisher.new(report, user).publish + rescue ActiveRecord::RecordNotFound => e + Rails.logger.error( + message: 'Cannot refresh report data', + exception: e, + report_id: report.id + ) + end + # endregion HELPER METHODS Tenant.prioritize(Tenant.creation_finalized).each do |tenant| @@ -46,15 +56,15 @@ namespace :single_use do .with_widget_type('CommentsByTimeWidget', 'PostsByTimeWidget') .preload(content_buildable: :owner) - layouts.each do |layout| - Rails.logger.info( - 'migrate_deprecated_participation_widgets', - tenant_id: tenant.id, - tenant_host: tenant.host, - layout_id: layout.id - ) - - migrate_layout(layout) + Rails.logger.tagged( + task: 'migrate_deprecated_participation_widgets', + tenant_id: tenant.id, + tenant_host: tenant.host + ) do + layouts.each do |layout| + Rails.logger.info('Layout migration', layout_id: layout.id) + migrate_layout(layout) + end end end end From 07404e5bc0e84253eaaab918a10e8b35c62b8511 Mon Sep 17 00:00:00 2001 From: EdwinKato Date: Wed, 31 Jul 2024 20:06:16 +0300 Subject: [PATCH 2/2] Fix contrast of empty progress bar on proposals --- .../ReactionControl/Status/components/ProposalProgressBar.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/front/app/containers/InitiativesShow/ReactionControl/Status/components/ProposalProgressBar.tsx b/front/app/containers/InitiativesShow/ReactionControl/Status/components/ProposalProgressBar.tsx index 5abf5b30aa9e..cb3bbb456e3d 100644 --- a/front/app/containers/InitiativesShow/ReactionControl/Status/components/ProposalProgressBar.tsx +++ b/front/app/containers/InitiativesShow/ReactionControl/Status/components/ProposalProgressBar.tsx @@ -13,6 +13,9 @@ import messages from '../../messages'; const StyledProgressBar = styled(ProgressBar)` height: 12px; width: 100%; + border: ${(props) => + props.bgShaded ? 'none' : `1px solid ${props.theme.colors.tenantPrimary}`}; + border-radius: ${(props) => props.theme.borderRadius}; `; interface Props {