decidim-admin 0.26.8 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-admin might be problematic. Click here for more details.

Files changed (283) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/admin/attachments_privacy_warning/show.erb +3 -0
  3. data/app/cells/decidim/admin/attachments_privacy_warning_cell.rb +19 -0
  4. data/app/commands/decidim/admin/block_user.rb +3 -8
  5. data/app/commands/decidim/admin/close_session_managed_user.rb +1 -1
  6. data/app/commands/decidim/admin/create_area.rb +1 -1
  7. data/app/commands/decidim/admin/create_area_type.rb +6 -3
  8. data/app/commands/decidim/admin/create_attachment.rb +14 -6
  9. data/app/commands/decidim/admin/create_attachment_collection.rb +13 -4
  10. data/app/commands/decidim/admin/create_category.rb +6 -4
  11. data/app/commands/decidim/admin/create_component.rb +1 -1
  12. data/app/commands/decidim/admin/create_import.rb +4 -5
  13. data/app/commands/decidim/admin/create_import_example.rb +1 -1
  14. data/app/commands/decidim/admin/create_newsletter.rb +1 -1
  15. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +1 -1
  16. data/app/commands/decidim/admin/create_scope.rb +1 -1
  17. data/app/commands/decidim/admin/create_scope_type.rb +6 -3
  18. data/app/commands/decidim/admin/create_static_page.rb +1 -1
  19. data/app/commands/decidim/admin/create_static_page_topic.rb +1 -1
  20. data/app/commands/decidim/admin/deliver_newsletter.rb +6 -6
  21. data/app/commands/decidim/admin/destroy_area.rb +1 -1
  22. data/app/commands/decidim/admin/destroy_category.rb +6 -3
  23. data/app/commands/decidim/admin/destroy_component.rb +1 -1
  24. data/app/commands/decidim/admin/destroy_newsletter.rb +1 -1
  25. data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +1 -1
  26. data/app/commands/decidim/admin/destroy_scope.rb +1 -1
  27. data/app/commands/decidim/admin/destroy_share_token.rb +1 -1
  28. data/app/commands/decidim/admin/destroy_static_page.rb +1 -1
  29. data/app/commands/decidim/admin/destroy_static_page_topic.rb +1 -1
  30. data/app/commands/decidim/admin/hide_resource.rb +2 -2
  31. data/app/commands/decidim/admin/impersonate_user.rb +1 -1
  32. data/app/commands/decidim/admin/invite_admin.rb +1 -1
  33. data/app/commands/decidim/admin/officialize_user.rb +1 -1
  34. data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +7 -3
  35. data/app/commands/decidim/admin/process_user_group_verification_csv.rb +8 -4
  36. data/app/commands/decidim/admin/promote_managed_user.rb +1 -1
  37. data/app/commands/decidim/admin/publish_component.rb +2 -2
  38. data/app/commands/decidim/admin/reject_user_group.rb +1 -1
  39. data/app/commands/decidim/admin/remove_admin.rb +1 -1
  40. data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
  41. data/app/commands/decidim/admin/transfer_user.rb +1 -1
  42. data/app/commands/decidim/admin/unblock_user.rb +2 -2
  43. data/app/commands/decidim/admin/unhide_resource.rb +1 -1
  44. data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
  45. data/app/commands/decidim/admin/unpublish_component.rb +1 -1
  46. data/app/commands/decidim/admin/unreport_resource.rb +1 -1
  47. data/app/commands/decidim/admin/unreport_user.rb +1 -1
  48. data/app/commands/decidim/admin/update_area.rb +1 -1
  49. data/app/commands/decidim/admin/update_area_type.rb +8 -3
  50. data/app/commands/decidim/admin/update_attachment.rb +4 -3
  51. data/app/commands/decidim/admin/update_attachment_collection.rb +8 -3
  52. data/app/commands/decidim/admin/update_category.rb +9 -5
  53. data/app/commands/decidim/admin/update_component.rb +8 -5
  54. data/app/commands/decidim/admin/update_component_permissions.rb +9 -6
  55. data/app/commands/decidim/admin/update_content_block.rb +1 -1
  56. data/app/commands/decidim/admin/update_external_domain_whitelist.rb +6 -3
  57. data/app/commands/decidim/admin/update_help_sections.rb +17 -3
  58. data/app/commands/decidim/admin/update_newsletter.rb +1 -1
  59. data/app/commands/decidim/admin/update_organization.rb +1 -1
  60. data/app/commands/decidim/admin/update_organization_appearance.rb +1 -1
  61. data/app/commands/decidim/admin/update_organization_tos_version.rb +1 -1
  62. data/app/commands/decidim/admin/update_resource_permissions.rb +2 -2
  63. data/app/commands/decidim/admin/update_scope.rb +1 -1
  64. data/app/commands/decidim/admin/update_scope_type.rb +8 -3
  65. data/app/commands/decidim/admin/update_static_page.rb +1 -1
  66. data/app/commands/decidim/admin/update_static_page_topic.rb +1 -1
  67. data/app/commands/decidim/admin/update_user_groups.rb +1 -1
  68. data/app/commands/decidim/admin/verify_user_group.rb +1 -1
  69. data/app/controllers/concerns/decidim/admin/filterable.rb +1 -1
  70. data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +3 -1
  71. data/app/controllers/decidim/admin/admin_terms_controller.rb +1 -1
  72. data/app/controllers/decidim/admin/application_controller.rb +1 -1
  73. data/app/controllers/decidim/admin/area_types_controller.rb +6 -3
  74. data/app/controllers/decidim/admin/block_user_controller.rb +3 -3
  75. data/app/controllers/decidim/admin/categories_controller.rb +3 -3
  76. data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
  77. data/app/controllers/decidim/admin/components/base_controller.rb +1 -0
  78. data/app/controllers/decidim/admin/components_controller.rb +1 -1
  79. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +6 -3
  80. data/app/controllers/decidim/admin/concerns/has_attachments.rb +6 -3
  81. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +7 -0
  82. data/app/controllers/decidim/admin/dashboard_controller.rb +4 -3
  83. data/app/controllers/decidim/admin/exports_controller.rb +4 -1
  84. data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
  85. data/app/controllers/decidim/admin/metrics_controller.rb +2 -1
  86. data/app/controllers/decidim/admin/moderations_controller.rb +9 -7
  87. data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
  88. data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
  89. data/app/controllers/decidim/admin/organization_controller.rb +3 -4
  90. data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +1 -1
  91. data/app/controllers/decidim/admin/reminders_controller.rb +61 -0
  92. data/app/controllers/decidim/admin/resource_permissions_controller.rb +3 -3
  93. data/app/controllers/decidim/admin/scope_types_controller.rb +6 -3
  94. data/app/controllers/decidim/admin/static_page_topics_controller.rb +3 -1
  95. data/app/controllers/decidim/admin/static_pages_controller.rb +1 -7
  96. data/app/forms/decidim/admin/block_user_form.rb +2 -2
  97. data/app/forms/decidim/admin/category_form.rb +1 -2
  98. data/app/forms/decidim/admin/component_form.rb +16 -7
  99. data/app/forms/decidim/admin/import_example_form.rb +1 -5
  100. data/app/forms/decidim/admin/import_form.rb +7 -10
  101. data/app/forms/decidim/admin/managed_user_promotion_form.rb +1 -1
  102. data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +7 -4
  103. data/app/forms/decidim/admin/permission_form.rb +9 -8
  104. data/app/forms/decidim/admin/permissions_form.rb +1 -10
  105. data/app/forms/decidim/admin/user_group_csv_verification_form.rb +2 -2
  106. data/app/helpers/decidim/admin/bulk_actions_helper.rb +6 -5
  107. data/app/helpers/decidim/admin/moderations/reports_helper.rb +11 -2
  108. data/app/helpers/decidim/admin/reminders_helper.rb +12 -0
  109. data/app/helpers/decidim/admin/settings_helper.rb +11 -57
  110. data/app/models/decidim/admin/fake_newsletter.rb +0 -20
  111. data/app/packs/entrypoints/decidim_admin.js +3 -6
  112. data/app/packs/src/decidim/admin/admin_autocomplete.js +82 -0
  113. data/app/packs/src/decidim/admin/application.js +0 -16
  114. data/app/packs/src/decidim/admin/choose_language.js +9 -11
  115. data/app/packs/src/decidim/admin/draggable-list.js +1 -1
  116. data/app/packs/src/decidim/admin/dynamic_fields.component.js +0 -1
  117. data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -1
  118. data/app/packs/stylesheets/decidim/admin/extra/_quill.scss +0 -7
  119. data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +5 -0
  120. data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +0 -6
  121. data/app/packs/stylesheets/decidim/admin/modules/_import_result.scss +10 -0
  122. data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +3 -0
  123. data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +42 -0
  124. data/app/permissions/decidim/admin/permissions.rb +4 -46
  125. data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +3 -1
  126. data/app/queries/decidim/admin/active_users_counter.rb +1 -1
  127. data/app/queries/decidim/admin/newsletter_recipients.rb +2 -2
  128. data/app/queries/decidim/admin/user_filter.rb +1 -1
  129. data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
  130. data/app/views/decidim/admin/area_types/edit.html.erb +0 -1
  131. data/app/views/decidim/admin/area_types/index.html.erb +0 -1
  132. data/app/views/decidim/admin/area_types/new.html.erb +0 -1
  133. data/app/views/decidim/admin/areas/edit.html.erb +0 -1
  134. data/app/views/decidim/admin/areas/index.html.erb +0 -1
  135. data/app/views/decidim/admin/areas/new.html.erb +0 -1
  136. data/app/views/decidim/admin/attachment_collections/edit.html.erb +0 -1
  137. data/app/views/decidim/admin/attachment_collections/index.html.erb +0 -1
  138. data/app/views/decidim/admin/attachment_collections/new.html.erb +0 -1
  139. data/app/views/decidim/admin/attachments/edit.html.erb +0 -1
  140. data/app/views/decidim/admin/attachments/index.html.erb +1 -1
  141. data/app/views/decidim/admin/attachments/new.html.erb +0 -1
  142. data/app/views/decidim/admin/authorization_workflows/index.html.erb +0 -1
  143. data/app/views/decidim/admin/categories/_form.html.erb +0 -4
  144. data/app/views/decidim/admin/categories/edit.html.erb +0 -1
  145. data/app/views/decidim/admin/categories/index.html.erb +0 -1
  146. data/app/views/decidim/admin/categories/new.html.erb +0 -1
  147. data/app/views/decidim/admin/categories/show.html.erb +1 -2
  148. data/app/views/decidim/admin/components/edit.html.erb +0 -1
  149. data/app/views/decidim/admin/components/index.html.erb +0 -1
  150. data/app/views/decidim/admin/components/new.html.erb +1 -1
  151. data/app/views/decidim/admin/conflicts/index.html.erb +0 -1
  152. data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
  153. data/app/views/decidim/admin/help_sections/show.erb +0 -1
  154. data/app/views/decidim/admin/impersonatable_users/index.html.erb +0 -1
  155. data/app/views/decidim/admin/impersonations/new.html.erb +0 -1
  156. data/app/views/decidim/admin/imports/new.html.erb +1 -1
  157. data/app/views/decidim/admin/logs/index.html.erb +0 -1
  158. data/app/views/decidim/admin/moderated_users/index.html.erb +1 -2
  159. data/app/views/decidim/admin/moderations/index.html.erb +4 -9
  160. data/app/views/decidim/admin/moderations/reports/index.html.erb +1 -5
  161. data/app/views/decidim/admin/newsletter_templates/index.html.erb +0 -1
  162. data/app/views/decidim/admin/newsletter_templates/show.html.erb +0 -1
  163. data/app/views/decidim/admin/newsletters/index.html.erb +0 -1
  164. data/app/views/decidim/admin/newsletters/new.html.erb +0 -1
  165. data/app/views/decidim/admin/newsletters/show.html.erb +0 -1
  166. data/app/views/decidim/admin/officializations/index.html.erb +10 -15
  167. data/app/views/decidim/admin/officializations/new.html.erb +0 -1
  168. data/app/views/decidim/admin/organization/edit.html.erb +0 -1
  169. data/app/views/decidim/admin/organization_appearance/edit.html.erb +0 -1
  170. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -4
  171. data/app/views/decidim/admin/organization_external_domain_whitelist/edit.html.erb +0 -1
  172. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
  173. data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +20 -1
  174. data/app/views/decidim/admin/reminders/new.html.erb +21 -0
  175. data/app/views/decidim/admin/resource_permissions/edit.html.erb +1 -1
  176. data/app/views/decidim/admin/scope_types/edit.html.erb +0 -1
  177. data/app/views/decidim/admin/scope_types/index.html.erb +0 -1
  178. data/app/views/decidim/admin/scope_types/new.html.erb +0 -1
  179. data/app/views/decidim/admin/scopes/edit.html.erb +0 -1
  180. data/app/views/decidim/admin/scopes/index.html.erb +0 -1
  181. data/app/views/decidim/admin/scopes/new.html.erb +0 -1
  182. data/app/views/decidim/admin/shared/_gallery.html.erb +6 -1
  183. data/app/views/decidim/admin/shared/_js-callout.html.erb +6 -0
  184. data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +0 -1
  185. data/app/views/decidim/admin/static_page_topics/edit.html.erb +0 -1
  186. data/app/views/decidim/admin/static_page_topics/new.html.erb +0 -1
  187. data/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
  188. data/app/views/decidim/admin/static_pages/edit.html.erb +0 -1
  189. data/app/views/decidim/admin/static_pages/index.html.erb +0 -1
  190. data/app/views/decidim/admin/static_pages/new.html.erb +0 -1
  191. data/app/views/decidim/admin/user_groups/index.html.erb +0 -1
  192. data/app/views/decidim/admin/user_groups_csv_verifications/new.html.erb +0 -1
  193. data/app/views/decidim/admin/users/index.html.erb +0 -1
  194. data/app/views/decidim/admin/users/new.html.erb +0 -1
  195. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
  196. data/app/views/layouts/decidim/admin/_application.html.erb +2 -0
  197. data/app/views/layouts/decidim/admin/global_moderations.html.erb +0 -1
  198. data/config/locales/am-ET.yml +1 -0
  199. data/config/locales/ar.yml +33 -31
  200. data/config/locales/bg.yml +1 -0
  201. data/config/locales/ca.yml +32 -29
  202. data/config/locales/cs.yml +43 -38
  203. data/config/locales/da.yml +1 -0
  204. data/config/locales/de.yml +28 -28
  205. data/config/locales/el.yml +4 -64
  206. data/config/locales/en.yml +25 -23
  207. data/config/locales/eo.yml +1 -0
  208. data/config/locales/es-MX.yml +29 -26
  209. data/config/locales/es-PY.yml +29 -26
  210. data/config/locales/es.yml +32 -29
  211. data/config/locales/et.yml +1 -0
  212. data/config/locales/eu.yml +22 -40
  213. data/config/locales/fi-plain.yml +28 -25
  214. data/config/locales/fi.yml +33 -30
  215. data/config/locales/fr-CA.yml +28 -25
  216. data/config/locales/fr.yml +43 -40
  217. data/config/locales/ga-IE.yml +1 -0
  218. data/config/locales/gl.yml +22 -4
  219. data/config/locales/hr.yml +1 -0
  220. data/config/locales/hu.yml +35 -222
  221. data/config/locales/id-ID.yml +4 -7
  222. data/config/locales/is-IS.yml +5 -8
  223. data/config/locales/it.yml +13 -6
  224. data/config/locales/ja.yml +32 -30
  225. data/config/locales/ko.yml +1 -0
  226. data/config/locales/lb.yml +7 -5
  227. data/config/locales/lt.yml +18 -141
  228. data/config/locales/lv.yml +6 -4
  229. data/config/locales/mt.yml +1 -0
  230. data/config/locales/nl.yml +8 -66
  231. data/config/locales/no.yml +18 -10
  232. data/config/locales/om-ET.yml +1 -0
  233. data/config/locales/pl.yml +26 -6
  234. data/config/locales/pt-BR.yml +7 -69
  235. data/config/locales/pt.yml +7 -5
  236. data/config/locales/ro-RO.yml +21 -36
  237. data/config/locales/ru.yml +4 -7
  238. data/config/locales/si-LK.yml +1 -0
  239. data/config/locales/sk.yml +6 -4
  240. data/config/locales/sl.yml +1 -0
  241. data/config/locales/so-SO.yml +1 -0
  242. data/config/locales/sr-CS.yml +5 -10
  243. data/config/locales/sv.yml +30 -18
  244. data/config/locales/sw-KE.yml +1 -0
  245. data/config/locales/ti-ER.yml +1 -0
  246. data/config/locales/tr-TR.yml +7 -8
  247. data/config/locales/uk.yml +4 -6
  248. data/config/locales/val-ES.yml +1 -0
  249. data/config/locales/vi.yml +1 -0
  250. data/config/locales/zh-CN.yml +6 -4
  251. data/config/locales/zh-TW.yml +1 -1075
  252. data/lib/decidim/admin/engine.rb +1 -12
  253. data/lib/decidim/admin/form_builder.rb +2 -1
  254. data/lib/decidim/admin/import/importer.rb +9 -7
  255. data/lib/decidim/admin/import/readers/json.rb +1 -1
  256. data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +15 -2
  257. data/lib/decidim/admin/test/commands/create_category_examples.rb +16 -6
  258. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +29 -1
  259. data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +15 -2
  260. data/lib/decidim/admin/test/commands/update_category_examples.rb +16 -6
  261. data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +4 -4
  262. data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +4 -4
  263. data/lib/decidim/admin/test/forms/category_form_examples.rb +1 -21
  264. data/lib/decidim/admin/test/manage_attachments_examples.rb +9 -2
  265. data/lib/decidim/admin/test/manage_categories_examples.rb +0 -10
  266. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +0 -2
  267. data/lib/decidim/admin/test/manage_moderations_examples.rb +27 -79
  268. data/lib/decidim/admin/test.rb +0 -1
  269. data/lib/decidim/admin/version.rb +1 -1
  270. metadata +22 -25
  271. data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -42
  272. data/app/controllers/decidim/admin/space_publications_controller.rb +0 -63
  273. data/app/packs/src/decidim/admin/autocomplete.component.js +0 -146
  274. data/app/packs/src/decidim/admin/autocomplete.component.test.js +0 -19
  275. data/app/packs/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +0 -19
  276. data/config/environment.rb +0 -1
  277. data/config/locales/fa-IR.yml +0 -1
  278. data/config/locales/gn-PY.yml +0 -1
  279. data/config/locales/ka-GE.yml +0 -1
  280. data/config/locales/kaa.yml +0 -200
  281. data/config/locales/lo-LA.yml +0 -1
  282. data/config/locales/oc-FR.yml +0 -1
  283. data/lib/decidim/admin/test/needs_admin_tos_accepted_examples.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ae3bb30016e22eb88e8cdf9118dbe1c1c58702539d2a68ce4863eaf17d40099
4
- data.tar.gz: b319929c123442784d3416426d3b2cd30cf7a84a06ee15ecc40822270946782c
3
+ metadata.gz: bd57dbd303809b47c0bbf9c466c4ed731f6e3d4c8b6604d1adb478114f5ef0cb
4
+ data.tar.gz: e77d08a54416dbff1d3481d3ddf32de28828d475143ff5cb4b5c536114106c45
5
5
  SHA512:
6
- metadata.gz: d56cddac04cded212214f8f962171db9b0940650d338c9da3645ce15cf678cfca72ff58c6192b365a38da11b47773483daf59d4e51ae58f5b6e807a0def34907
7
- data.tar.gz: 7c060e1ba90c6a94afc4a26d0c94c0706bc8aab1db866045d3b7df7bb78f45fc5a80da36a530205ff8415328a53f27e9d8e772eef3b897f5ee3643f87dcefc93
6
+ metadata.gz: b97e7a0cdb53e8c909c42e7fc6b2cd345f66f61c67648a3c086ad2db8ba9e9dc936e60d51cfaf7689d086d4c9a1f347b2432f22f9e7590743bec4897c278cf17
7
+ data.tar.gz: 96cb283bb59d1026e5de9d917db4dbf185ef5384442a9166f1211077c757554d6680dec253d1408da3924ae381b9dfcbb590f50c1cd73bd80b5120c4cd1cba78
@@ -0,0 +1,3 @@
1
+ <% if private_space? && !(transparent_space?) %>
2
+ <div class="callout warning"><%= t("decidim.admin.attachments_privacy_warning.message") %></div>
3
+ <% end %>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Admin
5
+ class AttachmentsPrivacyWarningCell < Decidim::ViewModel
6
+ delegate :current_participatory_space, to: :controller
7
+
8
+ private
9
+
10
+ def private_space?
11
+ current_participatory_space.private_space if current_participatory_space.respond_to?(:private_space)
12
+ end
13
+
14
+ def transparent_space?
15
+ current_participatory_space.is_transparent if current_participatory_space.respond_to?(:is_transparent)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Admin
5
- class BlockUser < Rectify::Command
5
+ class BlockUser < Decidim::Command
6
6
  # Public: Initializes the command.
7
7
  #
8
8
  # form - BlockUserForm
@@ -20,9 +20,8 @@ module Decidim
20
20
  return broadcast(:invalid) unless form.valid?
21
21
 
22
22
  transaction do
23
- find_or_create_moderation!
24
- register_justification!
25
23
  block!
24
+ register_justification!
26
25
  notify_user!
27
26
  end
28
27
 
@@ -33,10 +32,6 @@ module Decidim
33
32
 
34
33
  attr_reader :form
35
34
 
36
- def find_or_create_moderation!
37
- Decidim::UserModeration.create_or_find_by!(user: form.user)
38
- end
39
-
40
35
  def register_justification!
41
36
  @current_blocking = UserBlock.create!(
42
37
  justification: form.justification,
@@ -70,7 +65,7 @@ module Decidim
70
65
  ) do
71
66
  form.user.blocked = true
72
67
  form.user.blocked_at = Time.current
73
- form.user.block_id = @current_blocking.id
68
+ form.user.blocking = @current_blocking
74
69
  form.user.extended_data["user_name"] = form.user.name
75
70
  form.user.name = "Blocked user"
76
71
  form.user.save!
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to close a current impersonation session.
6
- class CloseSessionManagedUser < Rectify::Command
6
+ class CloseSessionManagedUser < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # user - The user impersonated.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when creating an area
6
- class CreateArea < Rectify::Command
6
+ class CreateArea < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - A form object with the params.
@@ -3,12 +3,13 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when creating an area type.
6
- class CreateAreaType < Rectify::Command
6
+ class CreateAreaType < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - A form object with the params.
10
- def initialize(form)
10
+ def initialize(form, user)
11
11
  @form = form
12
+ @user = user
12
13
  end
13
14
 
14
15
  # Executes the command. Broadcasts these events:
@@ -29,7 +30,9 @@ module Decidim
29
30
  attr_reader :form
30
31
 
31
32
  def create_area_type
32
- AreaType.create!(
33
+ Decidim.traceability.create!(
34
+ AreaType,
35
+ @user,
33
36
  name: form.name,
34
37
  organization: form.organization,
35
38
  plural: form.plural
@@ -4,14 +4,15 @@ module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to add an attachment to a
6
6
  # participatory process.
7
- class CreateAttachment < Rectify::Command
7
+ class CreateAttachment < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form object with the params.
11
11
  # attached_to - The ActiveRecord::Base that will hold the attachment
12
- def initialize(form, attached_to)
12
+ def initialize(form, attached_to, user)
13
13
  @form = form
14
14
  @attached_to = attached_to
15
+ @user = user
15
16
  end
16
17
 
17
18
  # Executes the command. Broadcasts these events:
@@ -26,9 +27,12 @@ module Decidim
26
27
  build_attachment
27
28
 
28
29
  if @attachment.valid?
29
- @attachment.save!
30
- notify_followers
31
- broadcast(:ok)
30
+ Decidim.traceability.perform_action!(:create, Decidim::Attachment, @user) do
31
+ @attachment.save!
32
+ notify_followers
33
+ broadcast(:ok)
34
+ @attachment
35
+ end
32
36
  else
33
37
  @form.errors.add :file, @attachment.errors[:file] if @attachment.errors.has_key? :file
34
38
  broadcast(:invalid)
@@ -47,7 +51,7 @@ module Decidim
47
51
  weight: form.weight,
48
52
  attachment_collection: form.attachment_collection,
49
53
  file: form.file, # Define attached_to before this
50
- content_type: form.file.content_type
54
+ content_type: blob(form.file).content_type
51
55
  )
52
56
  end
53
57
 
@@ -61,6 +65,10 @@ module Decidim
61
65
  followers: @attachment.attached_to.followers
62
66
  )
63
67
  end
68
+
69
+ def blob(signed_id)
70
+ ActiveStorage::Blob.find_signed(signed_id)
71
+ end
64
72
  end
65
73
  end
66
74
  end
@@ -4,14 +4,15 @@ module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to add an attachment collection
6
6
  # to a participatory space.
7
- class CreateAttachmentCollection < Rectify::Command
7
+ class CreateAttachmentCollection < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form object with the params.
11
11
  # collection_for - The ActiveRecord::Base that will hold the collection
12
- def initialize(form, collection_for)
12
+ def initialize(form, collection_for, user)
13
13
  @form = form
14
14
  @collection_for = collection_for
15
+ @user = user
15
16
  end
16
17
 
17
18
  # Executes the command. Broadcasts these events:
@@ -32,12 +33,20 @@ module Decidim
32
33
  attr_reader :form
33
34
 
34
35
  def create_attachment_collection
35
- AttachmentCollection.create!(
36
+ Decidim.traceability.create!(
37
+ AttachmentCollection,
38
+ @user,
39
+ attributes
40
+ )
41
+ end
42
+
43
+ def attributes
44
+ {
36
45
  name: form.name,
37
46
  weight: form.weight,
38
47
  description: form.description,
39
48
  collection_for: @collection_for
40
- )
49
+ }
41
50
  end
42
51
  end
43
52
  end
@@ -4,15 +4,16 @@ module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to create a new category in the
6
6
  # system.
7
- class CreateCategory < Rectify::Command
7
+ class CreateCategory < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form object with the params.
11
11
  # participatory_space - The participatory space that will hold the
12
12
  # category
13
- def initialize(form, participatory_space)
13
+ def initialize(form, participatory_space, user)
14
14
  @form = form
15
15
  @participatory_space = participatory_space
16
+ @user = user
16
17
  end
17
18
 
18
19
  # Executes the command. Broadcasts these events:
@@ -33,10 +34,11 @@ module Decidim
33
34
  attr_reader :form
34
35
 
35
36
  def create_category
36
- Category.create!(
37
+ Decidim.traceability.create!(
38
+ Category,
39
+ @user,
37
40
  name: form.name,
38
41
  weight: form.weight,
39
- description: form.description,
40
42
  parent_id: form.parent_id,
41
43
  participatory_space: @participatory_space
42
44
  )
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # This command gets called when a component is created from the admin panel.
6
- class CreateComponent < Rectify::Command
6
+ class CreateComponent < Decidim::Command
7
7
  attr_reader :form, :manifest, :participatory_space
8
8
 
9
9
  # Public: Initializes the command.
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Admin
5
- class CreateImport < Rectify::Command
5
+ class CreateImport < Decidim::Command
6
6
  def initialize(form)
7
7
  @form = form
8
8
  end
@@ -14,13 +14,12 @@ module Decidim
14
14
  transaction do
15
15
  form.importer.import!
16
16
 
17
- return broadcast(:ok, imported_data)
17
+ broadcast(:ok, imported_data)
18
18
  rescue StandardError
19
+ # Something went wrong with import/finish
20
+ broadcast(:invalid)
19
21
  raise ActiveRecord::Rollback
20
22
  end
21
-
22
- # Something went wrong with import/finish
23
- broadcast(:invalid)
24
23
  end
25
24
 
26
25
  attr_reader :form
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Admin
5
- class CreateImportExample < Rectify::Command
5
+ class CreateImportExample < Decidim::Command
6
6
  def initialize(form)
7
7
  @form = form
8
8
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Admin
5
5
  # Creates a newsletter and assigns the right author and
6
6
  # organization.
7
- class CreateNewsletter < Rectify::Command
7
+ class CreateNewsletter < Decidim::Command
8
8
  # Initializes the command.
9
9
  #
10
10
  # form - The source fo data for this newsletter.
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when creating a new participatory space
6
6
  # private user in the system.
7
- class CreateParticipatorySpacePrivateUser < Rectify::Command
7
+ class CreateParticipatorySpacePrivateUser < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # form - A form object with the params.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when creating a static scope.
6
- class CreateScope < Rectify::Command
6
+ class CreateScope < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - A form object with the params.
@@ -3,12 +3,13 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when creating a scope type.
6
- class CreateScopeType < Rectify::Command
6
+ class CreateScopeType < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - A form object with the params.
10
- def initialize(form)
10
+ def initialize(form, user)
11
11
  @form = form
12
+ @user = user
12
13
  end
13
14
 
14
15
  # Executes the command. Broadcasts these events:
@@ -29,7 +30,9 @@ module Decidim
29
30
  attr_reader :form
30
31
 
31
32
  def create_scope_type
32
- ScopeType.create!(
33
+ Decidim.traceability.create!(
34
+ ScopeType,
35
+ @user,
33
36
  name: form.name,
34
37
  organization: form.organization,
35
38
  plural: form.plural
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when creating a static page.
6
- class CreateStaticPage < Rectify::Command
6
+ class CreateStaticPage < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - A form object with the params.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when creating a static page topic.
6
- class CreateStaticPageTopic < Rectify::Command
6
+ class CreateStaticPageTopic < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - A form object with the params.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # Delivers the newsletter to its recipients.
6
- class DeliverNewsletter < Rectify::Command
6
+ class DeliverNewsletter < Decidim::Command
7
7
  # Initializes the command.
8
8
  #
9
9
  # newsletter - The newsletter to deliver.
@@ -16,12 +16,12 @@ module Decidim
16
16
  end
17
17
 
18
18
  def call
19
- @newsletter.with_lock do
20
- return broadcast(:invalid) if @form.send_to_all_users && !@user.admin?
21
- return broadcast(:invalid) unless @form.valid?
22
- return broadcast(:invalid) if @newsletter.sent?
23
- return broadcast(:no_recipients) if recipients.blank?
19
+ return broadcast(:invalid) if @form.send_to_all_users && !@user.admin?
20
+ return broadcast(:invalid) unless @form.valid?
21
+ return broadcast(:invalid) if @newsletter.sent?
22
+ return broadcast(:no_recipients) if recipients.blank?
24
23
 
24
+ @newsletter.with_lock do
25
25
  send_newsletter!
26
26
  end
27
27
 
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to destroy an area.
6
- class DestroyArea < Rectify::Command
6
+ class DestroyArea < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # area - The area to destroy
@@ -4,12 +4,13 @@ module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to destroy a category in the
6
6
  # system.
7
- class DestroyCategory < Rectify::Command
7
+ class DestroyCategory < Decidim::Command
8
8
  # Public: Initializes the command.
9
9
  #
10
10
  # category - A Category that will be destroyed
11
- def initialize(category)
11
+ def initialize(category, user)
12
12
  @category = category
13
+ @user = user
13
14
  end
14
15
 
15
16
  # Executes the command. Broadcasts these events:
@@ -30,7 +31,9 @@ module Decidim
30
31
  attr_reader :category
31
32
 
32
33
  def destroy_category
33
- category.destroy!
34
+ Decidim.traceability.perform_action!(:delete, category, @user) do
35
+ category.destroy!
36
+ end
34
37
  end
35
38
  end
36
39
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # This command deals with destroying a Component from the admin panel.
6
- class DestroyComponent < Rectify::Command
6
+ class DestroyComponent < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # component - The Component to be destroyed.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # This command deals with destroying a newsletter from the admin panel.
6
- class DestroyNewsletter < Rectify::Command
6
+ class DestroyNewsletter < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # newsletter - The Newsletter to be destroyed.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to destroy a participatory space private user.
6
- class DestroyParticipatorySpacePrivateUser < Rectify::Command
6
+ class DestroyParticipatorySpacePrivateUser < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # participatory_space_private_user - The participatory space private user to destroy
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to destroy a scope.
6
- class DestroyScope < Rectify::Command
6
+ class DestroyScope < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # scope - The Scope to destroy
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to destroy a share token.
6
- class DestroyShareToken < Rectify::Command
6
+ class DestroyShareToken < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # share_token - The share_token to destroy
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # This command deals with destroying a StaticPage from the admin panel.
6
- class DestroyStaticPage < Rectify::Command
6
+ class DestroyStaticPage < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # page - The StaticPage to be destroyed.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # This command deals with destroying a StaticPageTopic from the admin panel.
6
- class DestroyStaticPageTopic < Rectify::Command
6
+ class DestroyStaticPageTopic < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # page - The StaticPageTopic to be destroyed.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when a user hides a resource.
6
- class HideResource < Rectify::Command
6
+ class HideResource < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # reportable - A Decidim::Reportable
@@ -60,7 +60,7 @@ module Decidim
60
60
  affected_users: @reportable.try(:authors) || [@reportable.try(:normalized_author)]
61
61
  }
62
62
 
63
- Decidim::EventsManager.publish(data)
63
+ Decidim::EventsManager.publish(**data)
64
64
  end
65
65
 
66
66
  def report_reasons
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic to impersonate a managed user.
6
- class ImpersonateUser < Rectify::Command
6
+ class ImpersonateUser < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - The form with the authorization info
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command to invite an admin.
6
- class InviteAdmin < Rectify::Command
6
+ class InviteAdmin < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - A form object with the params.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when officializing a user.
6
- class OfficializeUser < Rectify::Command
6
+ class OfficializeUser < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # form - The officialization form.
@@ -4,7 +4,9 @@ require "csv"
4
4
 
5
5
  module Decidim
6
6
  module Admin
7
- class ProcessParticipatorySpacePrivateUserImportCsv < Rectify::Command
7
+ class ProcessParticipatorySpacePrivateUserImportCsv < Decidim::Command
8
+ include Decidim::ProcessesFileLocally
9
+
8
10
  # Public: Initializes the command.
9
11
  #
10
12
  # form - the form object containing the uploaded file
@@ -32,8 +34,10 @@ module Decidim
32
34
  private
33
35
 
34
36
  def process_csv
35
- CSV.foreach(@form.file.path, encoding: "BOM|UTF-8") do |email, user_name|
36
- ImportParticipatorySpacePrivateUserCsvJob.perform_later(email, user_name, @private_users_to, @current_user) if email.present? && user_name.present?
37
+ process_file_locally(@form.file) do |file_path|
38
+ CSV.foreach(file_path, encoding: "BOM|UTF-8") do |email, user_name|
39
+ ImportParticipatorySpacePrivateUserCsvJob.perform_later(email, user_name, @private_users_to, @current_user) if email.present? && user_name.present?
40
+ end
37
41
  end
38
42
  end
39
43
  end
@@ -6,7 +6,9 @@ module Decidim
6
6
  module Admin
7
7
  # A command with all the business logic when processing the CSV to verify
8
8
  # user groups.
9
- class ProcessUserGroupVerificationCsv < Rectify::Command
9
+ class ProcessUserGroupVerificationCsv < Decidim::Command
10
+ include Decidim::ProcessesFileLocally
11
+
10
12
  # Public: Initializes the command.
11
13
  #
12
14
  # form - the form object containing the uploaded file
@@ -33,9 +35,11 @@ module Decidim
33
35
  verifier = @form.current_user
34
36
  organization = @form.current_organization
35
37
 
36
- CSV.foreach(@form.file.path) do |row|
37
- email = row[0]
38
- VerifyUserGroupFromCsvJob.perform_later(email, verifier, organization) if email.present?
38
+ process_file_locally(@form.file) do |file_path|
39
+ CSV.foreach(file_path) do |row|
40
+ email = row[0]
41
+ VerifyUserGroupFromCsvJob.perform_later(email, verifier, organization) if email.present?
42
+ end
39
43
  end
40
44
  end
41
45
  end
@@ -7,7 +7,7 @@ module Decidim
7
7
  # Managed users can be promoted to standard users. It means they
8
8
  # will be invited to the application and will lose the managed flag
9
9
  # so the user cannot be impersonated anymore.
10
- class PromoteManagedUser < Rectify::Command
10
+ class PromoteManagedUser < Decidim::Command
11
11
  # Public: Initializes the command.
12
12
  #
13
13
  # form - A form object with the params.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # This command gets called when a component is published from the admin panel.
6
- class PublishComponent < Rectify::Command
6
+ class PublishComponent < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # component - The component to publish.
@@ -18,7 +18,7 @@ module Decidim
18
18
  # Broadcasts :ok if published, :invalid otherwise.
19
19
  def call
20
20
  publish_component
21
- publish_event unless component.previously_published?
21
+ publish_event
22
22
 
23
23
  broadcast(:ok)
24
24
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  # A command with all the business logic when rejecting a user_group.
6
- class RejectUserGroup < Rectify::Command
6
+ class RejectUserGroup < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # user_group - The user_group to reject