decidim-admin 0.26.10 → 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 (289) 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/concerns/decidim/moderations/admin/filterable.rb +0 -4
  72. data/app/controllers/decidim/admin/admin_terms_controller.rb +1 -1
  73. data/app/controllers/decidim/admin/application_controller.rb +1 -2
  74. data/app/controllers/decidim/admin/area_types_controller.rb +6 -3
  75. data/app/controllers/decidim/admin/block_user_controller.rb +3 -3
  76. data/app/controllers/decidim/admin/categories_controller.rb +3 -3
  77. data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
  78. data/app/controllers/decidim/admin/components/base_controller.rb +1 -0
  79. data/app/controllers/decidim/admin/components_controller.rb +1 -1
  80. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +6 -3
  81. data/app/controllers/decidim/admin/concerns/has_attachments.rb +6 -3
  82. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +7 -0
  83. data/app/controllers/decidim/admin/dashboard_controller.rb +4 -3
  84. data/app/controllers/decidim/admin/exports_controller.rb +4 -1
  85. data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
  86. data/app/controllers/decidim/admin/metrics_controller.rb +2 -1
  87. data/app/controllers/decidim/admin/moderations_controller.rb +9 -7
  88. data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
  89. data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
  90. data/app/controllers/decidim/admin/organization_controller.rb +3 -4
  91. data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +1 -1
  92. data/app/controllers/decidim/admin/reminders_controller.rb +61 -0
  93. data/app/controllers/decidim/admin/resource_permissions_controller.rb +3 -3
  94. data/app/controllers/decidim/admin/scope_types_controller.rb +6 -3
  95. data/app/controllers/decidim/admin/static_page_topics_controller.rb +3 -1
  96. data/app/controllers/decidim/admin/static_pages_controller.rb +1 -7
  97. data/app/forms/decidim/admin/block_user_form.rb +2 -2
  98. data/app/forms/decidim/admin/category_form.rb +1 -2
  99. data/app/forms/decidim/admin/component_form.rb +16 -7
  100. data/app/forms/decidim/admin/import_example_form.rb +1 -5
  101. data/app/forms/decidim/admin/import_form.rb +7 -10
  102. data/app/forms/decidim/admin/managed_user_promotion_form.rb +1 -1
  103. data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +7 -4
  104. data/app/forms/decidim/admin/permission_form.rb +9 -8
  105. data/app/forms/decidim/admin/permissions_form.rb +1 -10
  106. data/app/forms/decidim/admin/user_group_csv_verification_form.rb +2 -2
  107. data/app/helpers/decidim/admin/bulk_actions_helper.rb +6 -5
  108. data/app/helpers/decidim/admin/moderations/reports_helper.rb +11 -2
  109. data/app/helpers/decidim/admin/reminders_helper.rb +12 -0
  110. data/app/helpers/decidim/admin/settings_helper.rb +11 -57
  111. data/app/models/decidim/admin/fake_newsletter.rb +0 -20
  112. data/app/packs/entrypoints/decidim_admin.js +3 -6
  113. data/app/packs/src/decidim/admin/admin_autocomplete.js +82 -0
  114. data/app/packs/src/decidim/admin/application.js +0 -16
  115. data/app/packs/src/decidim/admin/choose_language.js +9 -11
  116. data/app/packs/src/decidim/admin/draggable-list.js +1 -1
  117. data/app/packs/src/decidim/admin/dynamic_fields.component.js +0 -1
  118. data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -1
  119. data/app/packs/stylesheets/decidim/admin/extra/_quill.scss +0 -7
  120. data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +5 -0
  121. data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +0 -6
  122. data/app/packs/stylesheets/decidim/admin/modules/_import_result.scss +10 -0
  123. data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +3 -0
  124. data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +42 -0
  125. data/app/permissions/decidim/admin/permissions.rb +4 -46
  126. data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +3 -1
  127. data/app/queries/decidim/admin/active_users_counter.rb +1 -1
  128. data/app/queries/decidim/admin/newsletter_recipients.rb +2 -2
  129. data/app/queries/decidim/admin/user_filter.rb +1 -1
  130. data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
  131. data/app/views/decidim/admin/area_types/edit.html.erb +0 -1
  132. data/app/views/decidim/admin/area_types/index.html.erb +0 -1
  133. data/app/views/decidim/admin/area_types/new.html.erb +0 -1
  134. data/app/views/decidim/admin/areas/edit.html.erb +0 -1
  135. data/app/views/decidim/admin/areas/index.html.erb +0 -1
  136. data/app/views/decidim/admin/areas/new.html.erb +0 -1
  137. data/app/views/decidim/admin/attachment_collections/edit.html.erb +0 -1
  138. data/app/views/decidim/admin/attachment_collections/index.html.erb +0 -1
  139. data/app/views/decidim/admin/attachment_collections/new.html.erb +0 -1
  140. data/app/views/decidim/admin/attachments/edit.html.erb +0 -1
  141. data/app/views/decidim/admin/attachments/index.html.erb +1 -1
  142. data/app/views/decidim/admin/attachments/new.html.erb +0 -1
  143. data/app/views/decidim/admin/authorization_workflows/index.html.erb +0 -1
  144. data/app/views/decidim/admin/categories/_form.html.erb +0 -4
  145. data/app/views/decidim/admin/categories/edit.html.erb +0 -1
  146. data/app/views/decidim/admin/categories/index.html.erb +0 -1
  147. data/app/views/decidim/admin/categories/new.html.erb +0 -1
  148. data/app/views/decidim/admin/categories/show.html.erb +1 -2
  149. data/app/views/decidim/admin/components/_component.html.erb +41 -3
  150. data/app/views/decidim/admin/components/edit.html.erb +0 -1
  151. data/app/views/decidim/admin/components/index.html.erb +0 -1
  152. data/app/views/decidim/admin/components/new.html.erb +1 -1
  153. data/app/views/decidim/admin/conflicts/index.html.erb +0 -1
  154. data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
  155. data/app/views/decidim/admin/help_sections/show.erb +0 -1
  156. data/app/views/decidim/admin/impersonatable_users/index.html.erb +0 -1
  157. data/app/views/decidim/admin/impersonations/new.html.erb +0 -1
  158. data/app/views/decidim/admin/imports/new.html.erb +1 -1
  159. data/app/views/decidim/admin/logs/index.html.erb +0 -1
  160. data/app/views/decidim/admin/moderated_users/index.html.erb +1 -2
  161. data/app/views/decidim/admin/moderations/index.html.erb +4 -9
  162. data/app/views/decidim/admin/moderations/reports/index.html.erb +1 -5
  163. data/app/views/decidim/admin/newsletter_templates/index.html.erb +0 -1
  164. data/app/views/decidim/admin/newsletter_templates/show.html.erb +0 -1
  165. data/app/views/decidim/admin/newsletters/index.html.erb +0 -1
  166. data/app/views/decidim/admin/newsletters/new.html.erb +0 -1
  167. data/app/views/decidim/admin/newsletters/show.html.erb +0 -1
  168. data/app/views/decidim/admin/officializations/index.html.erb +10 -15
  169. data/app/views/decidim/admin/officializations/new.html.erb +0 -1
  170. data/app/views/decidim/admin/organization/edit.html.erb +0 -1
  171. data/app/views/decidim/admin/organization_appearance/edit.html.erb +0 -1
  172. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -4
  173. data/app/views/decidim/admin/organization_external_domain_whitelist/edit.html.erb +0 -1
  174. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
  175. data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +20 -1
  176. data/app/views/decidim/admin/reminders/new.html.erb +21 -0
  177. data/app/views/decidim/admin/resource_permissions/edit.html.erb +1 -1
  178. data/app/views/decidim/admin/scope_types/edit.html.erb +0 -1
  179. data/app/views/decidim/admin/scope_types/index.html.erb +0 -1
  180. data/app/views/decidim/admin/scope_types/new.html.erb +0 -1
  181. data/app/views/decidim/admin/scopes/edit.html.erb +0 -1
  182. data/app/views/decidim/admin/scopes/index.html.erb +0 -1
  183. data/app/views/decidim/admin/scopes/new.html.erb +0 -1
  184. data/app/views/decidim/admin/shared/_gallery.html.erb +6 -1
  185. data/app/views/decidim/admin/shared/_js-callout.html.erb +6 -0
  186. data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +0 -1
  187. data/app/views/decidim/admin/static_page_topics/edit.html.erb +0 -1
  188. data/app/views/decidim/admin/static_page_topics/new.html.erb +0 -1
  189. data/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
  190. data/app/views/decidim/admin/static_pages/edit.html.erb +0 -1
  191. data/app/views/decidim/admin/static_pages/index.html.erb +0 -1
  192. data/app/views/decidim/admin/static_pages/new.html.erb +0 -1
  193. data/app/views/decidim/admin/user_groups/index.html.erb +0 -1
  194. data/app/views/decidim/admin/user_groups_csv_verifications/new.html.erb +0 -1
  195. data/app/views/decidim/admin/users/index.html.erb +0 -1
  196. data/app/views/decidim/admin/users/new.html.erb +0 -1
  197. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
  198. data/app/views/layouts/decidim/admin/_application.html.erb +2 -0
  199. data/app/views/layouts/decidim/admin/global_moderations.html.erb +0 -1
  200. data/config/locales/am-ET.yml +1 -0
  201. data/config/locales/ar.yml +44 -38
  202. data/config/locales/bg.yml +1 -0
  203. data/config/locales/ca.yml +39 -36
  204. data/config/locales/cs.yml +47 -42
  205. data/config/locales/da.yml +1 -0
  206. data/config/locales/de.yml +52 -52
  207. data/config/locales/el.yml +14 -65
  208. data/config/locales/en.yml +25 -23
  209. data/config/locales/eo.yml +1 -0
  210. data/config/locales/es-MX.yml +36 -33
  211. data/config/locales/es-PY.yml +36 -33
  212. data/config/locales/es.yml +39 -36
  213. data/config/locales/et.yml +1 -0
  214. data/config/locales/eu.yml +291 -324
  215. data/config/locales/fi-plain.yml +31 -28
  216. data/config/locales/fi.yml +36 -33
  217. data/config/locales/fr-CA.yml +35 -32
  218. data/config/locales/fr.yml +52 -49
  219. data/config/locales/ga-IE.yml +1 -0
  220. data/config/locales/gl.yml +33 -6
  221. data/config/locales/hr.yml +1 -0
  222. data/config/locales/hu.yml +44 -222
  223. data/config/locales/id-ID.yml +10 -10
  224. data/config/locales/is-IS.yml +6 -9
  225. data/config/locales/it.yml +22 -6
  226. data/config/locales/ja.yml +39 -37
  227. data/config/locales/ko.yml +1 -0
  228. data/config/locales/lb.yml +18 -7
  229. data/config/locales/lt.yml +21 -156
  230. data/config/locales/lv.yml +15 -4
  231. data/config/locales/mt.yml +1 -0
  232. data/config/locales/nl.yml +19 -68
  233. data/config/locales/no.yml +27 -10
  234. data/config/locales/om-ET.yml +1 -0
  235. data/config/locales/pl.yml +29 -25
  236. data/config/locales/pt-BR.yml +16 -85
  237. data/config/locales/pt.yml +19 -8
  238. data/config/locales/ro-RO.yml +32 -38
  239. data/config/locales/ru.yml +10 -9
  240. data/config/locales/si-LK.yml +1 -0
  241. data/config/locales/sk.yml +15 -4
  242. data/config/locales/sl.yml +1 -0
  243. data/config/locales/so-SO.yml +1 -0
  244. data/config/locales/sr-CS.yml +9 -20
  245. data/config/locales/sv.yml +39 -19
  246. data/config/locales/sw-KE.yml +1 -0
  247. data/config/locales/ti-ER.yml +1 -0
  248. data/config/locales/tr-TR.yml +19 -11
  249. data/config/locales/uk.yml +10 -6
  250. data/config/locales/val-ES.yml +1 -0
  251. data/config/locales/vi.yml +1 -0
  252. data/config/locales/zh-CN.yml +15 -4
  253. data/config/locales/zh-TW.yml +1 -1066
  254. data/config/routes.rb +0 -2
  255. data/lib/decidim/admin/engine.rb +1 -12
  256. data/lib/decidim/admin/form_builder.rb +2 -1
  257. data/lib/decidim/admin/import/importer.rb +9 -7
  258. data/lib/decidim/admin/import/readers/json.rb +1 -1
  259. data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +15 -2
  260. data/lib/decidim/admin/test/commands/create_category_examples.rb +16 -6
  261. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +29 -1
  262. data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +15 -2
  263. data/lib/decidim/admin/test/commands/update_category_examples.rb +16 -6
  264. data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +4 -4
  265. data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +4 -4
  266. data/lib/decidim/admin/test/forms/category_form_examples.rb +1 -21
  267. data/lib/decidim/admin/test/manage_attachments_examples.rb +9 -2
  268. data/lib/decidim/admin/test/manage_categories_examples.rb +0 -10
  269. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +0 -2
  270. data/lib/decidim/admin/test/manage_moderations_examples.rb +27 -79
  271. data/lib/decidim/admin/test.rb +0 -1
  272. data/lib/decidim/admin/version.rb +1 -1
  273. metadata +22 -34
  274. data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -78
  275. data/app/packs/src/decidim/admin/autocomplete.component.js +0 -144
  276. data/app/packs/src/decidim/admin/autocomplete.component.test.js +0 -19
  277. data/app/packs/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +0 -19
  278. data/app/views/decidim/admin/components/_actions.html.erb +0 -43
  279. data/config/environment.rb +0 -3
  280. data/config/locales/fa-IR.yml +0 -1
  281. data/config/locales/gn-PY.yml +0 -1
  282. data/config/locales/ka-GE.yml +0 -1
  283. data/config/locales/kaa.yml +0 -214
  284. data/config/locales/lo-LA.yml +0 -1
  285. data/config/locales/oc-FR.yml +0 -1
  286. data/config/locales/sq-AL.yml +0 -65
  287. data/config/locales/th-TH.yml +0 -1
  288. data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +0 -49
  289. data/lib/decidim/admin/test/needs_admin_tos_accepted_examples.rb +0 -9
data/config/routes.rb CHANGED
@@ -36,8 +36,6 @@ Decidim::Admin::Engine.routes.draw do
36
36
  mount manifest.admin_engine, at: "/#{manifest.name}", as: "decidim_admin_#{manifest.name}"
37
37
  end
38
38
 
39
- mount Decidim::Templates::AdminEngine, at: "/templates", as: "decidim_admin_templates" if Decidim.module_installed?(:templates)
40
-
41
39
  resources :users, except: [:edit, :update], controller: "users" do
42
40
  member do
43
41
  post :resend_invitation, to: "users#resend_invitation"
@@ -7,7 +7,6 @@ require "devise"
7
7
  require "devise-i18n"
8
8
  require "decidim/core"
9
9
  require "foundation_rails_helper"
10
- require "rectify"
11
10
  require "doorkeeper"
12
11
  require "doorkeeper-i18n"
13
12
  require "hashdiff"
@@ -174,10 +173,7 @@ module Decidim
174
173
  decidim_admin.root_path,
175
174
  icon_name: "dashboard",
176
175
  position: 1,
177
- active: [%w(
178
- decidim/admin/dashboard
179
- decidim/admin/metrics
180
- ), []]
176
+ active: ["decidim/admin/dashboard" => :show]
181
177
 
182
178
  menu.add_item :moderations,
183
179
  I18n.t("menu.moderation", scope: "decidim.admin"),
@@ -212,15 +208,10 @@ module Decidim
212
208
  decidim/admin/user_groups_csv_verifications
213
209
  decidim/admin/officializations
214
210
  decidim/admin/impersonatable_users
215
- decidim/admin/conflicts
216
211
  decidim/admin/moderated_users
217
212
  decidim/admin/managed_users/impersonation_logs
218
213
  decidim/admin/managed_users/promotions
219
214
  decidim/admin/authorization_workflows
220
- decidim/verifications/id_documents/admin/pending_authorizations
221
- decidim/verifications/id_documents/admin/config
222
- decidim/verifications/postal_letter/admin/pending_authorizations
223
- decidim/verifications/csv_census/admin/census
224
215
  ), []],
225
216
  if: allowed_to?(:read, :admin_user) || allowed_to?(:read, :managed_user)
226
217
 
@@ -247,8 +238,6 @@ module Decidim
247
238
  decidim/admin/scopes
248
239
  decidim/admin/scope_types
249
240
  decidim/admin/areas decidim/admin/area_types
250
- decidim/admin/help_sections
251
- decidim/admin/organization_external_domain_whitelist
252
241
  ),
253
242
  []
254
243
  ],
@@ -67,7 +67,8 @@ module Decidim
67
67
  name,
68
68
  {
69
69
  toolbar: :full,
70
- lines: 25
70
+ lines: 25,
71
+ editor_images: true
71
72
  }.merge(options)
72
73
  )
73
74
  end
@@ -10,6 +10,8 @@ module Decidim
10
10
  # You can also use the ImporterFactory class to create an Importer
11
11
  # instance.
12
12
  class Importer
13
+ include Decidim::ProcessesFileLocally
14
+
13
15
  delegate :errors, to: :verifier
14
16
 
15
17
  # Public: Initializes an Importer.
@@ -72,15 +74,15 @@ module Decidim
72
74
  return @collection_data if @collection_data
73
75
 
74
76
  @collection_data = []
75
- reader.new(file).read_rows do |rowdata, index|
76
- if index.zero?
77
- @data_headers = rowdata.map { |d| d.to_s.to_sym }
78
- else
79
- @collection_data << Hash[
80
- rowdata.each_with_index.map do |val, ind|
77
+ process_file_locally(file) do |file_path|
78
+ reader.new(file_path).read_rows do |rowdata, index|
79
+ if index.zero?
80
+ @data_headers = rowdata.map { |d| d.to_s.to_sym }
81
+ else
82
+ @collection_data << rowdata.each_with_index.to_h do |val, ind|
81
83
  [@data_headers[ind], val]
82
84
  end
83
- ]
85
+ end
84
86
  end
85
87
  end
86
88
 
@@ -39,7 +39,7 @@ module Decidim
39
39
  columns = data.shift
40
40
  json_data = data.map do |row|
41
41
  deep_hash(
42
- columns.each_with_index.map { |col, ind| [col, row[ind]] }.to_h
42
+ columns.each_with_index.to_h { |col, ind| [col, row[ind]] }
43
43
  )
44
44
  end
45
45
 
@@ -7,6 +7,7 @@ module Decidim
7
7
  shared_examples_for "CreateAttachmentCollection command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:form_params) do
11
12
  {
12
13
  "attachment_collection" => {
@@ -27,11 +28,11 @@ module Decidim
27
28
  current_organization: organization
28
29
  )
29
30
  end
30
- let(:command) { described_class.new(form, collection_for) }
31
+ let(:command) { described_class.new(form, collection_for, user) }
31
32
 
32
33
  describe "when the form is not valid" do
33
34
  before do
34
- expect(form).to receive(:invalid?).and_return(true)
35
+ allow(form).to receive(:invalid?).and_return(true)
35
36
  end
36
37
 
37
38
  it "broadcasts invalid" do
@@ -55,6 +56,18 @@ module Decidim
55
56
  command.call
56
57
  end.to change(collection_for.attachment_collections, :count).by(1)
57
58
  end
59
+
60
+ it "traces the action", versioning: true do
61
+ expect(Decidim.traceability)
62
+ .to receive(:perform_action!)
63
+ .with(:create, Decidim::AttachmentCollection, user, {})
64
+ .and_call_original
65
+
66
+ expect { command.call }.to change(Decidim::ActionLog, :count)
67
+ action_log = Decidim::ActionLog.last
68
+ expect(action_log.action).to eq("create")
69
+ expect(action_log.version).to be_present
70
+ end
58
71
  end
59
72
  end
60
73
  end
@@ -7,15 +7,13 @@ module Decidim
7
7
  shared_examples_for "CreateCategory command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:form_params) do
11
12
  {
12
13
  "category" => {
13
14
  "name_en" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
14
15
  "name_es" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
15
- "name_ca" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
16
- "description_en" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
17
- "description_es" => Decidim::Faker::Localized.paragraph(sentence_count: 3),
18
- "description_ca" => Decidim::Faker::Localized.paragraph(sentence_count: 3)
16
+ "name_ca" => Decidim::Faker::Localized.paragraph(sentence_count: 3)
19
17
  }
20
18
  }
21
19
  end
@@ -27,11 +25,11 @@ module Decidim
27
25
  current_organization: organization
28
26
  )
29
27
  end
30
- let(:command) { described_class.new(form, participatory_space) }
28
+ let(:command) { described_class.new(form, participatory_space, user) }
31
29
 
32
30
  describe "when the form is not valid" do
33
31
  before do
34
- expect(form).to receive(:invalid?).and_return(true)
32
+ allow(form).to receive(:invalid?).and_return(true)
35
33
  end
36
34
 
37
35
  it "broadcasts invalid" do
@@ -55,6 +53,18 @@ module Decidim
55
53
  command.call
56
54
  end.to change(participatory_space.categories, :count).by(1)
57
55
  end
56
+
57
+ it "traces the action", versioning: true do
58
+ expect(Decidim.traceability)
59
+ .to receive(:perform_action!)
60
+ .with(:create, Decidim::Category, user, {})
61
+ .and_call_original
62
+
63
+ expect { command.call }.to change(Decidim::ActionLog, :count)
64
+ action_log = Decidim::ActionLog.last
65
+ expect(action_log.action).to eq("create")
66
+ expect(action_log.version).to be_present
67
+ end
58
68
  end
59
69
  end
60
70
  end
@@ -7,8 +7,9 @@ module Decidim
7
7
  shared_examples_for "DestroyCategory command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:category) { create(:category, participatory_space: participatory_space) }
11
- let(:command) { described_class.new(category) }
12
+ let(:command) { described_class.new(category, user) }
12
13
 
13
14
  describe "when the category is not present" do
14
15
  let(:category) { nil }
@@ -28,6 +29,21 @@ module Decidim
28
29
  end
29
30
  end
30
31
 
32
+ context "when the category is a subcategory" do
33
+ let!(:parent_category) { create :category, participatory_space: participatory_space }
34
+
35
+ before do
36
+ category.parent = parent_category
37
+ end
38
+
39
+ it "destroy the category" do
40
+ category
41
+ expect do
42
+ command.call
43
+ end.to change(Category, :count).by(-1)
44
+ end
45
+ end
46
+
31
47
  describe "when the data is valid" do
32
48
  it "broadcasts ok" do
33
49
  expect { command.call }.to broadcast(:ok)
@@ -39,6 +55,18 @@ module Decidim
39
55
  command.call
40
56
  end.to change(Category, :count).by(-1)
41
57
  end
58
+
59
+ it "traces the action", versioning: true do
60
+ expect(Decidim.traceability)
61
+ .to receive(:perform_action!)
62
+ .with(:delete, category, user)
63
+ .and_call_original
64
+
65
+ expect { command.call }.to change(Decidim::ActionLog, :count)
66
+ action_log = Decidim::ActionLog.last
67
+ expect(action_log.action).to eq("delete")
68
+ expect(action_log.version).to be_present
69
+ end
42
70
  end
43
71
  end
44
72
  end
@@ -7,6 +7,7 @@ module Decidim
7
7
  shared_examples_for "UpdateAttachmentCollection command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:attachment_collection) { create(:attachment_collection, collection_for: collection_for) }
11
12
  let(:form_params) do
12
13
  {
@@ -28,11 +29,11 @@ module Decidim
28
29
  current_organization: organization
29
30
  )
30
31
  end
31
- let(:command) { described_class.new(attachment_collection, form) }
32
+ let(:command) { described_class.new(attachment_collection, form, user) }
32
33
 
33
34
  describe "when the form is not valid" do
34
35
  before do
35
- expect(form).to receive(:invalid?).and_return(true)
36
+ allow(form).to receive(:invalid?).and_return(true)
36
37
  end
37
38
 
38
39
  it "broadcasts invalid" do
@@ -58,6 +59,18 @@ module Decidim
58
59
 
59
60
  expect(translated(attachment_collection.name)).to eq("New title")
60
61
  end
62
+
63
+ it "traces the action", versioning: true do
64
+ expect(Decidim.traceability)
65
+ .to receive(:perform_action!)
66
+ .with(:update, Decidim::AttachmentCollection, user, {})
67
+ .and_call_original
68
+
69
+ expect { command.call }.to change(Decidim::ActionLog, :count)
70
+ action_log = Decidim::ActionLog.last
71
+ expect(action_log.action).to eq("update")
72
+ expect(action_log.version).to be_present
73
+ end
61
74
  end
62
75
  end
63
76
  end
@@ -7,16 +7,14 @@ module Decidim
7
7
  shared_examples_for "UpdateCategory command" do
8
8
  describe "call" do
9
9
  let(:organization) { create(:organization) }
10
+ let(:user) { create(:user, organization: organization) }
10
11
  let(:category) { create(:category, participatory_space: participatory_space) }
11
12
  let(:form_params) do
12
13
  {
13
14
  "category" => {
14
15
  "name_en" => "New title",
15
16
  "name_es" => "Title",
16
- "name_ca" => "Title",
17
- "description_en" => "Description",
18
- "description_es" => "Description",
19
- "description_ca" => "Description"
17
+ "name_ca" => "Title"
20
18
  }
21
19
  }
22
20
  end
@@ -28,11 +26,11 @@ module Decidim
28
26
  current_organization: organization
29
27
  )
30
28
  end
31
- let(:command) { described_class.new(category, form) }
29
+ let(:command) { described_class.new(category, form, user) }
32
30
 
33
31
  describe "when the form is not valid" do
34
32
  before do
35
- expect(form).to receive(:invalid?).and_return(true)
33
+ allow(form).to receive(:invalid?).and_return(true)
36
34
  end
37
35
 
38
36
  it "broadcasts invalid" do
@@ -58,6 +56,18 @@ module Decidim
58
56
 
59
57
  expect(translated(category.name)).to eq("New title")
60
58
  end
59
+
60
+ it "traces the action", versioning: true do
61
+ expect(Decidim.traceability)
62
+ .to receive(:perform_action!)
63
+ .with(:update, Decidim::Category, user, {})
64
+ .and_call_original
65
+
66
+ expect { command.call }.to change(Decidim::ActionLog, :count)
67
+ action_log = Decidim::ActionLog.last
68
+ expect(action_log.action).to eq("update")
69
+ expect(action_log.version).to be_present
70
+ end
61
71
  end
62
72
  end
63
73
  end
@@ -99,7 +99,7 @@ shared_examples "filterable participatory space user roles" do
99
99
  apply_filter("Invite accepted", "Yes")
100
100
 
101
101
  within ".stack tbody" do
102
- expect(page).to have_content(invited_user_2.name)
102
+ expect(page).to have_content(invited_user2.name)
103
103
  expect(page).to have_css("tr", count: 1)
104
104
  end
105
105
  end
@@ -110,7 +110,7 @@ shared_examples "filterable participatory space user roles" do
110
110
  apply_filter("Invite accepted", "No")
111
111
 
112
112
  within ".stack tbody" do
113
- expect(page).to have_content(invited_user_1.name)
113
+ expect(page).to have_content(invited_user1.name)
114
114
  expect(page).to have_css("tr", count: 1)
115
115
  end
116
116
  end
@@ -123,7 +123,7 @@ shared_examples "filterable participatory space user roles" do
123
123
  apply_filter("Ever logged in", "Yes")
124
124
 
125
125
  within ".stack tbody" do
126
- expect(page).to have_content(invited_user_2.name)
126
+ expect(page).to have_content(invited_user2.name)
127
127
  expect(page).to have_css("tr", count: 1)
128
128
  end
129
129
  end
@@ -134,7 +134,7 @@ shared_examples "filterable participatory space user roles" do
134
134
  apply_filter("Ever logged in", "No")
135
135
 
136
136
  within ".stack tbody" do
137
- expect(page).to have_content(invited_user_1.name)
137
+ expect(page).to have_content(invited_user1.name)
138
138
  expect(page).to have_css("tr", count: 1)
139
139
  end
140
140
  end
@@ -7,7 +7,7 @@ shared_examples "filterable participatory space users" do
7
7
  apply_filter("Invitation sent", "Not sent")
8
8
 
9
9
  within ".stack tbody" do
10
- expect(page).to have_content(invited_user_2.name)
10
+ expect(page).to have_content(invited_user2.name)
11
11
  expect(page).to have_css("tr", count: 1)
12
12
  end
13
13
  end
@@ -18,7 +18,7 @@ shared_examples "filterable participatory space users" do
18
18
  apply_filter("Invitation sent", "Sent")
19
19
 
20
20
  within ".stack tbody" do
21
- expect(page).to have_content(invited_user_1.name)
21
+ expect(page).to have_content(invited_user1.name)
22
22
  expect(page).to have_css("tr", count: 1)
23
23
  end
24
24
  end
@@ -31,7 +31,7 @@ shared_examples "filterable participatory space users" do
31
31
  apply_filter("Invitation accepted", "Not accepted")
32
32
 
33
33
  within ".stack tbody" do
34
- expect(page).to have_content(invited_user_2.name)
34
+ expect(page).to have_content(invited_user2.name)
35
35
  expect(page).to have_css("tr", count: 1)
36
36
  end
37
37
  end
@@ -42,7 +42,7 @@ shared_examples "filterable participatory space users" do
42
42
  apply_filter("Invitation accepted", "Accepted")
43
43
 
44
44
  within ".stack tbody" do
45
- expect(page).to have_content(invited_user_1.name)
45
+ expect(page).to have_content(invited_user1.name)
46
46
  expect(page).to have_css("tr", count: 1)
47
47
  end
48
48
  end
@@ -21,13 +21,6 @@ module Decidim
21
21
  ca: "Nom"
22
22
  }
23
23
  end
24
- let(:description) do
25
- {
26
- en: "Description",
27
- es: "Descripción",
28
- ca: "Descripció"
29
- }
30
- end
31
24
  let(:parent_id) { nil }
32
25
  let(:attributes) do
33
26
  {
@@ -35,10 +28,7 @@ module Decidim
35
28
  "name_en" => name[:en],
36
29
  "name_es" => name[:es],
37
30
  "name_ca" => name[:ca],
38
- "parent_id" => parent_id,
39
- "description_en" => description[:en],
40
- "description_es" => description[:es],
41
- "description_ca" => description[:ca]
31
+ "parent_id" => parent_id
42
32
  }
43
33
  }
44
34
  end
@@ -59,16 +49,6 @@ module Decidim
59
49
  it { is_expected.to be_invalid }
60
50
  end
61
51
 
62
- context "when some language in description is missing" do
63
- let(:description) do
64
- {
65
- ca: "Descripció"
66
- }
67
- end
68
-
69
- it { is_expected.to be_invalid }
70
- end
71
-
72
52
  context "when the parent_id is set" do
73
53
  let!(:category) { create :category, participatory_space: participatory_space }
74
54
 
@@ -48,8 +48,11 @@ shared_examples "manage attachments examples" do
48
48
  es: "Este documento contiene información importante",
49
49
  ca: "Aquest document conté informació important"
50
50
  )
51
+ end
52
+
53
+ dynamically_attach_file(:attachment_file, Decidim::Dev.asset("Exampledocument.pdf"))
51
54
 
52
- attach_file :attachment_file, Decidim::Dev.asset("Exampledocument.pdf")
55
+ within ".new_attachment" do
53
56
  find("*[type=submit]").click
54
57
  end
55
58
 
@@ -81,7 +84,11 @@ shared_examples "manage attachments examples" do
81
84
  )
82
85
 
83
86
  select translated(attachment_collection.name, locale: :en), from: "attachment_attachment_collection_id"
84
- attach_file :attachment_file, Decidim::Dev.asset("Exampledocument.pdf")
87
+ end
88
+
89
+ dynamically_attach_file(:attachment_file, Decidim::Dev.asset("Exampledocument.pdf"))
90
+
91
+ within ".new_attachment" do
85
92
  find("*[type=submit]").click
86
93
  end
87
94
 
@@ -14,9 +14,6 @@ shared_examples "manage categories examples" do
14
14
 
15
15
  expect(page).to have_selector("input#category_name_en[value='#{translated(category.name, locale: :en)}']")
16
16
  expect(page).to have_selector("input#category_weight[value='#{category.weight}']")
17
- within ".editor .editor-container" do
18
- expect(page).to have_content(strip_tags(translated(category.description, locale: :en)))
19
- end
20
17
 
21
18
  expect(page).to have_selector("select#category_parent_id")
22
19
  end
@@ -32,13 +29,6 @@ shared_examples "manage categories examples" do
32
29
  es: "Mi categoría",
33
30
  ca: "La meva categoria"
34
31
  )
35
- fill_in_i18n_editor(
36
- :category_description,
37
- "#category-description-tabs",
38
- en: "Description",
39
- es: "Descripción",
40
- ca: "Descripció"
41
- )
42
32
 
43
33
  find("*[type=submit]").click
44
34
  end
@@ -52,9 +52,7 @@ shared_examples "Managing component permissions" do
52
52
 
53
53
  context "when failing to set permissions" do
54
54
  before do
55
- # rubocop:disable RSpec/AnyInstance
56
55
  allow_any_instance_of(Decidim::Admin::PermissionsForm).to receive(:valid?).and_return(false)
57
- # rubocop:enable RSpec/AnyInstance
58
56
  within ".component-#{component.id}" do
59
57
  click_link "Permissions"
60
58
  end
@@ -1,5 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ shared_examples "sorted moderations" do
4
+ let!(:moderations) do
5
+ reportables.first(reportables.length - 1).map do |reportable|
6
+ moderation = create(:moderation, reportable: reportable, report_count: 1, reported_content: reportable.reported_searchable_content_text)
7
+ create(:report, moderation: moderation)
8
+ moderation
9
+ end
10
+ end
11
+ let!(:moderation) { moderations.first }
12
+ let(:moderations_link_text) { "Moderations" }
13
+
14
+ before do
15
+ visit participatory_space_path
16
+ click_link moderations_link_text
17
+ end
18
+
19
+ it "sorts the most recent first" do
20
+ within ".pagination" do
21
+ click_link "Last"
22
+ end
23
+ all("tbody tr").each_with_index do |row, _index|
24
+ expect(row.find("td:first-child")).to have_content(reportables.first.id)
25
+ end
26
+ end
27
+ end
28
+
3
29
  shared_examples "manage moderations" do
4
30
  let!(:moderations) do
5
31
  reportables.first(reportables.length - 1).map do |reportable|
@@ -110,53 +136,14 @@ shared_examples "manage moderations" do
110
136
  expect(page).to have_no_selector("tr[data-id=\"#{moderation.id}\"]")
111
137
  end
112
138
  end
113
-
114
- context "when the user changes language" do
115
- around do |example|
116
- previous_backend = I18n.backend
117
- I18n.backend = I18n::Backend::Simple.new
118
- example.run
119
- I18n.backend = previous_backend
120
- end
121
-
122
- before do
123
- I18n.backend.store_translations(
124
- :ca,
125
- activerecord: {
126
- models: {
127
- moderation.reportable.class.name.underscore.to_sym => {
128
- one: "Objecte informable",
129
- other: "Objectes informables"
130
- }
131
- }
132
- }
133
- )
134
-
135
- within_language_menu do
136
- click_link "Català"
137
- end
138
- end
139
-
140
- it "renders the reportable types in the selected language" do
141
- within "tr[data-id=\"#{moderation.id}\"]" do
142
- expect(page).to have_content("Objecte informable")
143
- end
144
- end
145
- end
146
139
  end
147
140
 
148
141
  context "when listing hidden resources" do
149
- before do
142
+ it "user can review them" do
150
143
  within ".card-title" do
151
144
  click_link "Hidden"
152
145
  end
153
- end
154
146
 
155
- it "user can't unreport them" do
156
- expect(page).not_to have_css(".action-icon--unreport")
157
- end
158
-
159
- it "user can review them" do
160
147
  hidden_moderations.each do |moderation|
161
148
  within "tr[data-id=\"#{moderation.id}\"]" do
162
149
  expect(page).to have_css("a[href='#{moderation.reportable.reported_content_url}']")
@@ -164,43 +151,4 @@ shared_examples "manage moderations" do
164
151
  end
165
152
  end
166
153
  end
167
-
168
- context "when listing comments for deleted resources" do
169
- let(:comments) do
170
- reportables.first(reportables.length - 1).map do |resource|
171
- create(:comment, commentable: resource)
172
- end
173
- end
174
- let!(:moderations) do
175
- comments.map do |reportable|
176
- space = reportable.is_a?(Decidim::Participable) ? reportable : reportable.participatory_space
177
- moderation = create(:moderation, reportable: reportable, report_count: 1, participatory_space: space, reported_content: reportable.reported_searchable_content_text)
178
- create(:report, moderation: moderation)
179
-
180
- reportable.root_commentable.destroy!
181
- reportable.reload
182
-
183
- moderation
184
- end
185
- end
186
-
187
- it "user can review them" do
188
- moderations.each do |moderation|
189
- within "tr[data-id=\"#{moderation.id}\"]" do
190
- expect(page).to have_content "Deleted resource"
191
- expect(page).to have_content "Spam"
192
- end
193
- end
194
- end
195
-
196
- it "user can hide them" do
197
- moderation_id = moderations.first.id
198
- within "tr[data-id=\"#{moderation_id}\"]" do
199
- click_link "Hide"
200
- end
201
-
202
- expect(page).to have_admin_callout("Resource successfully hidden")
203
- expect(page).not_to have_selector("tr[data-id=\"#{moderation_id}\"]")
204
- end
205
- end
206
154
  end
@@ -9,4 +9,3 @@ require "decidim/admin/test/manage_paginated_collection_examples"
9
9
  require "decidim/admin/test/filterable_examples"
10
10
  require "decidim/admin/test/filters_participatory_space_users_examples"
11
11
  require "decidim/admin/test/filters_participatory_space_user_roles_examples"
12
- require "decidim/admin/test/needs_admin_tos_accepted_examples"
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-admin version.
5
5
  module Admin
6
6
  def self.version
7
- "0.26.10"
7
+ "0.27.0.rc1"
8
8
  end
9
9
  end
10
10
  end