decidim 0.30.1 → 0.31.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +5 -9
  3. data/decidim-core/lib/decidim/{webpacker → shakapacker}/configuration.rb +4 -4
  4. data/decidim-core/lib/decidim/{webpacker → shakapacker}/runner.rb +3 -3
  5. data/decidim-core/lib/decidim/shakapacker/shakapacker.rb +8 -0
  6. data/decidim-core/lib/decidim/{webpacker → shakapacker}/shakapacker.yml +3 -1
  7. data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/custom.js +1 -1
  8. data/decidim.gemspec +1 -1
  9. data/docs/antora.yml +1 -1
  10. data/docs/modules/configure/pages/environment_variables.adoc +184 -35
  11. data/docs/modules/configure/pages/index.adoc +2 -3
  12. data/docs/modules/configure/pages/initializer.adoc +45 -31
  13. data/docs/modules/configure/pages/system.adoc +3 -3
  14. data/docs/modules/customize/assets/images/social-share-modal-default.png +0 -0
  15. data/docs/modules/customize/pages/admin_filters.adoc +2 -2
  16. data/docs/modules/customize/pages/content_security_policy.adoc +1 -1
  17. data/docs/modules/customize/pages/images.adoc +1 -1
  18. data/docs/modules/customize/pages/index.adoc +1 -0
  19. data/docs/modules/customize/pages/javascript.adoc +5 -18
  20. data/docs/modules/customize/pages/localization.adoc +75 -0
  21. data/docs/modules/customize/pages/oauth.adoc +12 -0
  22. data/docs/modules/customize/pages/social_shares.adoc +0 -3
  23. data/docs/modules/customize/pages/styles.adoc +3 -16
  24. data/docs/modules/develop/assets/attachments/grafana/metadecidim-csv.json +1106 -0
  25. data/docs/modules/develop/assets/attachments/grafana/metadecidim-graphql.json +632 -0
  26. data/docs/modules/develop/assets/images/grafana/create_account_confirm.png +0 -0
  27. data/docs/modules/develop/assets/images/grafana/create_account_form.png +0 -0
  28. data/docs/modules/develop/assets/images/grafana/create_account_setup.png +0 -0
  29. data/docs/modules/develop/assets/images/grafana/dashboard_example_csv.png +0 -0
  30. data/docs/modules/develop/assets/images/grafana/dashboard_example_graphql.png +0 -0
  31. data/docs/modules/develop/assets/images/grafana/dashboard_import.png +0 -0
  32. data/docs/modules/develop/assets/images/grafana/dashboard_import_csv.png +0 -0
  33. data/docs/modules/develop/assets/images/grafana/dashboards.png +0 -0
  34. data/docs/modules/develop/assets/images/grafana/homepage.png +0 -0
  35. data/docs/modules/develop/pages/api.adoc +12 -2
  36. data/docs/modules/develop/pages/classes/models.adoc +2 -2
  37. data/docs/modules/develop/pages/commentable.adoc +9 -11
  38. data/docs/modules/develop/pages/components.adoc +10 -10
  39. data/docs/modules/develop/pages/elections.adoc +101 -0
  40. data/docs/modules/develop/pages/fixing_locales.adoc +7 -12
  41. data/docs/modules/develop/pages/grafana.adoc +100 -0
  42. data/docs/modules/develop/pages/likeable.adoc +106 -0
  43. data/docs/modules/develop/pages/machine_translations.adoc +6 -2
  44. data/docs/modules/develop/pages/maintainers/releases.adoc +40 -202
  45. data/docs/modules/develop/pages/maps.adoc +8 -8
  46. data/docs/modules/develop/pages/modules.adoc +1 -1
  47. data/docs/modules/develop/pages/notifications.adoc +27 -56
  48. data/docs/modules/develop/pages/permissions.adoc +19 -19
  49. data/docs/modules/develop/pages/share_tokens.adoc +2 -2
  50. data/docs/modules/develop/pages/taxonomies.adoc +1 -15
  51. data/docs/modules/install/pages/checklist.adoc +2 -1
  52. data/docs/modules/install/pages/index.adoc +7 -12
  53. data/docs/modules/install/pages/manual.adoc +27 -35
  54. data/docs/modules/install/pages/update.adoc +0 -2
  55. data/docs/modules/install/partials/version_matrix.adoc +4 -2
  56. data/docs/modules/services/pages/activestorage.adoc +4 -3
  57. data/docs/modules/services/pages/aitools.adoc +0 -2
  58. data/docs/modules/services/pages/etherpad.adoc +5 -20
  59. data/docs/modules/services/pages/machine_translation.adoc +38 -0
  60. data/docs/modules/services/pages/maps.adoc +8 -66
  61. data/docs/modules/services/pages/pdf.adoc +33 -0
  62. data/docs/modules/services/pages/sms.adoc +6 -7
  63. data/docs/modules/services/pages/social_providers.adoc +1 -1
  64. data/docs/modules/services/pages/timestamp.adoc +47 -0
  65. data/lib/decidim/version.rb +1 -1
  66. data/package-lock.json +2413 -2624
  67. data/package.json +3 -2
  68. data/packages/browserslist-config/package.json +1 -1
  69. data/packages/core/package.json +2 -3
  70. data/packages/dev/package.json +2 -2
  71. data/packages/eslint-config/package.json +1 -1
  72. data/packages/prettier-config/package.json +1 -1
  73. data/packages/stylelint-config/package.json +1 -1
  74. data/packages/webpacker/package.json +3 -2
  75. data/packages/webpacker/src/loaders/decidim-sass-loader.js +18 -11
  76. metadata +68 -54
  77. data/docs/modules/develop/pages/endorsable.adoc +0 -110
  78. data/docs/modules/develop/pages/guide_migrate_webpacker_app.adoc +0 -257
  79. data/docs/modules/develop/pages/guide_migrate_webpacker_module.adoc +0 -132
  80. data/docs/modules/develop/pages/metrics.adoc +0 -123
  81. data/docs/modules/develop/pages/troubleshooting_metrics.adoc +0 -255
  82. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/esbuild.config.js +0 -0
  83. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/postcss.config.js +0 -0
  84. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/tsconfig.json +0 -0
  85. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/.modernizrrc +0 -0
  86. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/webpack.config.js +0 -0
@@ -1,255 +0,0 @@
1
- = How to fix metrics
2
-
3
- At the request of some instances, we have analyzed the issues related to metrics and looked for possible solutions.
4
-
5
- == Problems
6
-
7
- We have identified two main problems:
8
-
9
- * Metrics generation crashing, which cause ``MetricJob``s to run again and again.
10
- * Peaks in generated metrics, sudden changes from day to day when displaying metrics.
11
-
12
- === Metrics generation crashing
13
-
14
- We have identified only one culprit here: "orphans" records, meaning records whose related component or participatory space cannot be found in the database. This is because in a previous decidim release `ParticipatorySpaces` could be deleted but they were not deleted properly. So any application that has deleted a participatory space in the past, will probably have unrelated records that will make some metrics calculation crash.
15
-
16
- === Peaks in generated metrics
17
-
18
- If somehow the metrics jobs fail to execute for a period of time, big differences can appear in metrics. So first make sure that you have metrics for every day, if not https://github.com/decidim/decidim/blob/develop/docs/advanced/metrics.md[generate them].
19
-
20
- If you have metrics generated for almost everyday and still see drastic changes from day to day, take into account that changing the visibility of a component or participatory space (making them private or unpublishing them) will naturally cause big differences in generated metrics.
21
-
22
- Finally, if you see that the differences in some days are multiples of a previous generated metric, meaning suddenly you have exactly the double or the triple of a calculated metric, it is very likely that you have duplicate generated metrics. We have only seen this problem with instances using Sidekiq, not Delayed Job. We do not know the cause of this, but it seems to be a known issue https://blog.francium.tech/avoiding-duplicate-jobs-in-sidekiq-dcbb1aca1e20[Avoiding duplicate jobs in Sidekiq].
23
-
24
- == Solutions
25
-
26
- We cannot offer a definitive solution for duplicate metrics, other than to delete old duplicate metrics and generate them again. If this problem persists, however, consider using Delayed Job.
27
- For a given metric type (`rake decidim:metrics:list`) that has duplicates:
28
-
29
- * Option 1: Remove individually each metric record per day.
30
- * Option 2: Delete all metric records and recalculate them. https://github.com/decidim/decidim/blob/release/0.18-stable/CHANGELOG.md#participants-metrics[CHANGELOG] of decidim version 0.18 has an example for "participants".
31
-
32
- For orphan records, you can do the following:
33
-
34
- * Back up the database.
35
- * Delete orphan records from the console (code is below).
36
- * Delete "comments" metrics and recalculate them following the https://github.com/decidim/decidim/blob/release/0.18-stable/CHANGELOG.md#participants-metrics[aforementioned example].
37
-
38
- === Some queries that may help
39
-
40
- [source,ruby]
41
- ----
42
- GROUP_BY_FIELDS= %w(
43
- day
44
- metric_type
45
- decidim_organization_id
46
- participatory_space_type
47
- participatory_space_id
48
- related_object_type
49
- related_object_id
50
- decidim_category_id).join(', ')
51
-
52
- def remove_duplicates
53
- sql= <<~EOSQL.strip
54
- DELETE FROM decidim_metrics WHERE decidim_metrics.id NOT IN
55
- (SELECT id FROM (
56
- SELECT DISTINCT ON (#{GROUP_BY_FIELDS}) * FROM decidim_metrics));
57
- EOSQL
58
- end
59
-
60
- # DELETE FROM decidim_metrics WHERE decidim_metrics.id NOT IN \n (SELECT id FROM (\n SELECT DISTINCT ON (day, metric_type, decidim_organization_id, participatory_space_type, participatory_space_id, related_object_type, related_object_id, decidim_category_id) * FROM decidim_metrics));
61
- def count_duplicates
62
- sql= <<~EOSQL.strip
63
- SELECT count(1), #{GROUP_BY_FIELDS} FROM decidim_metrics GROUP BY #{GROUP_BY_FIELDS} HAVING COUNT(1) > 1;
64
- EOSQL
65
- end
66
- ----
67
-
68
- === Delete orphan records
69
-
70
- "proposals", "meetings", "accountability", "debates", "pages", "budgets", "surveys"
71
-
72
- ==== Proposals
73
-
74
- Delete proposals whose component does not have a participatory space and delete components of a proposal type that do not have a participatory space
75
-
76
- [source,ruby]
77
- ----
78
- Decidim::Component.where(manifest_name: "proposals").find_each(batch_size: 100) { |c|
79
- if c.participatory_space.blank?
80
- Decidim::Proposals::Proposal.where(component: c).destroy_all
81
- c.destroy
82
- end
83
- }
84
- ----
85
-
86
- Delete proposals that do not have a component
87
-
88
- [source,ruby]
89
- ----
90
- Decidim::Proposals::Proposal.find_each(batch_size: 100) { |proposal|
91
- proposal.delete if proposal.component.blank?
92
- }
93
- ----
94
-
95
- ==== Meetings
96
-
97
- Delete meetings whose component has no participatory space and delete components of meeting type that do not have a participatory space
98
-
99
- [source,ruby]
100
- ----
101
- Decidim::Component.where(manifest_name: "meetings").find_each(batch_size: 100) { |c|
102
- if c.participatory_space.blank?
103
- Decidim::Meetings::Meeting.where(component: c).destroy_all
104
- c.destroy
105
- end
106
- }
107
- ----
108
-
109
- Delete meetings that do not have a component
110
-
111
- [source,ruby]
112
- ----
113
- Decidim::Meetings::Meeting.find_each(batch_size: 100) { |meeting|
114
- meeting.delete if meeting.component.blank?
115
- }
116
- ----
117
-
118
- ==== Debates
119
-
120
- Delete debates that its component has no participatory space and the debate components that do not have a participatory space
121
-
122
- [source,ruby]
123
- ----
124
- Decidim::Component.where(manifest_name: "debates").find_each(batch_size: 100) { |c|
125
- if c.participatory_space.blank?
126
- Decidim::Debates::Debate.where(component: c).destroy_all
127
- c.destroy
128
- end
129
- }
130
- ----
131
-
132
- Destroy debates that do not have a component
133
-
134
- [source,ruby]
135
- ----
136
- Decidim::Debates::Debate.find_each(batch_size: 100) { |debate|
137
- debate.delete if debate.component.blank?
138
- }
139
- ----
140
-
141
- ==== Posts
142
-
143
- Destroy posts whose component has no participatory space and blog components that do not have a participatory space
144
-
145
- [source,ruby]
146
- ----
147
- Decidim::Component.where(manifest_name: "blogs").find_each(batch_size: 100) { |c|
148
- if c.participatory_space.blank?
149
- Decidim::Blogs::Post.where(component: c).destroy_all
150
- c.destroy
151
- end
152
- }
153
- ----
154
-
155
- Destroy posts that do not have a component
156
-
157
- [source,ruby]
158
- ----
159
- Decidim::Blogs::Post.find_each(batch_size: 100) { |post|
160
- post.delete if post.component.blank?
161
- }
162
- ----
163
-
164
- ==== Accountability
165
-
166
- Destroy results whose component has no participatory space and components of accountability type that do not have a participatory space
167
-
168
- [source,ruby]
169
- ----
170
- Decidim::Component.where(manifest_name: "accountability").find_each(batch_size: 100) { |c|
171
- if c.participatory_space.blank?
172
- Decidim::Accountability::Result.where(component: c).destroy_all
173
- c.destroy
174
- end
175
- }
176
- ----
177
-
178
- Destroy results that do not have a component
179
-
180
- [source,ruby]
181
- ----
182
- Decidim::Accountability::Result.find_each(batch_size: 100) { |result|
183
- result.delete if result.component.blank?
184
- }
185
- ----
186
-
187
- ==== Pages
188
-
189
- Destroy page components that do not have a participatory space
190
-
191
- [source,ruby]
192
- ----
193
- Decidim::Component.where(manifest_name: "pages").find_each(batch_size: 100) { |c|
194
- if c.participatory_space.blank?
195
- c.destroy
196
- end
197
- }
198
- ----
199
-
200
- ==== Budgets
201
-
202
- Destroy projects whose component has no participatory space and budget components that do not have a participatory space
203
-
204
- [source,ruby]
205
- ----
206
- Decidim::Component.where(manifest_name: "budgets").find_each(batch_size: 100) { |c|
207
- if c.participatory_space.blank?
208
- Decidim::Budgets::Project.where(component: c).destroy_all
209
- c.destroy
210
- end
211
- }
212
- ----
213
-
214
- Destroy results that do not have a component
215
-
216
- [source,ruby]
217
- ----
218
- Decidim::Budgets::Project.find_each(batch_size: 100) { |project|
219
- project.delete if project.component.blank?
220
- }
221
- ----
222
-
223
- ==== Surveys
224
-
225
- [source,ruby]
226
- ----
227
- Decidim::Component.where(manifest_name: "surveys").find_each(batch_size: 100) { |c|
228
- if c.participatory_space.blank?
229
- Decidim::Surveys::Survey.where(component: c).destroy_all
230
- c.destroy
231
- end
232
- }
233
- ----
234
-
235
- Destroy surveys that do not have a component
236
-
237
- [source,ruby]
238
- ----
239
- Decidim::Surveys::Survey.find_each(batch_size: 100) { |survey|
240
- survey.delete if survey.component.blank?
241
- }
242
- ----
243
-
244
- ==== Comments
245
-
246
- Destroy comments whose commentable root is a proposal that does not have a participatory space.
247
-
248
- [source,ruby]
249
- ----
250
- proposal_ids = Decidim::Comments::Comment.where(decidim_root_commentable_type: "Decidim::Proposals::Proposal").pluck(:decidim_root_commentable_id)
251
-
252
- proposal_ids_without_space = Decidim::Proposals::Proposal.where(id: proposal_ids).find_all{|p| p.participatory_space.blank? }.pluck(:id)
253
-
254
- Decidim::Comments::Comment.where(decidim_root_commentable_type: "Decidim::Proposals::Proposal", decidim_root_commentable_id: proposal_ids_without_space).destroy_all
255
- ----