decidim-core 0.29.2 → 0.30.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (474) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/amendable/amend_button_card/show.erb +6 -4
  3. data/app/cells/decidim/amendable/amend_button_card_cell.rb +8 -0
  4. data/app/cells/decidim/amendable/amendments/show.erb +1 -1
  5. data/app/cells/decidim/amendable/promote_button_card/show.erb +2 -0
  6. data/app/cells/decidim/author_cell.rb +1 -1
  7. data/app/cells/decidim/card_l/extra_data.erb +1 -0
  8. data/app/cells/decidim/card_metadata_cell.rb +9 -16
  9. data/app/cells/decidim/comments_button_cell.rb +14 -2
  10. data/app/cells/decidim/content_blocks/highlighted_elements_cell.rb +2 -0
  11. data/app/cells/decidim/content_blocks/highlighted_elements_with_cell_for_list_cell.rb +1 -1
  12. data/app/cells/decidim/endorsement_block/show.erb +0 -1
  13. data/app/cells/decidim/endorsement_block_cell.rb +6 -0
  14. data/app/cells/decidim/endorsement_buttons/button_content.erb +1 -1
  15. data/app/cells/decidim/endorsement_buttons/select_identity_button.erb +1 -1
  16. data/app/cells/decidim/endorsement_buttons/show.erb +7 -7
  17. data/app/cells/decidim/endorsement_buttons/verification_modal.erb +4 -2
  18. data/app/cells/decidim/endorsers_list/empty.erb +3 -0
  19. data/app/cells/decidim/endorsers_list/full.erb +17 -5
  20. data/app/cells/decidim/endorsers_list/show.erb +19 -10
  21. data/app/cells/decidim/endorsers_list_cell.rb +19 -6
  22. data/app/cells/decidim/follow_button/show.erb +1 -2
  23. data/app/cells/decidim/follow_button_cell.rb +5 -0
  24. data/app/cells/decidim/map/show.erb +3 -0
  25. data/app/cells/decidim/map/template.erb +14 -0
  26. data/app/cells/decidim/map_cell.rb +39 -0
  27. data/app/cells/decidim/notification_actions/buttons_cell.rb +1 -1
  28. data/app/cells/decidim/onboarding_action_message/show.erb +15 -0
  29. data/app/cells/decidim/onboarding_action_message_cell.rb +81 -0
  30. data/app/cells/decidim/participatory_space_private_user/show.erb +23 -0
  31. data/app/cells/decidim/participatory_space_private_user_cell.rb +21 -0
  32. data/app/cells/decidim/progress_bar/show.erb +2 -2
  33. data/app/cells/decidim/report_button_cell.rb +1 -0
  34. data/app/cells/decidim/resource_history/show.erb +20 -0
  35. data/app/cells/decidim/resource_history_cell.rb +66 -0
  36. data/app/cells/decidim/share_button_cell.rb +0 -4
  37. data/app/cells/decidim/share_widget/modal.erb +26 -0
  38. data/app/cells/decidim/share_widget/show.erb +2 -0
  39. data/app/cells/decidim/share_widget_cell.rb +20 -0
  40. data/app/cells/decidim/tags/show.erb +7 -4
  41. data/app/cells/decidim/tags_cell.rb +11 -72
  42. data/app/commands/decidim/amendable/create_draft.rb +2 -2
  43. data/app/commands/decidim/create_ephemeral_user.rb +52 -0
  44. data/app/commands/decidim/create_omniauth_registration.rb +13 -3
  45. data/app/commands/decidim/create_report.rb +1 -5
  46. data/app/commands/decidim/create_user_group.rb +6 -2
  47. data/app/commands/decidim/destroy_ephemeral_user.rb +47 -0
  48. data/app/commands/decidim/update_account.rb +11 -3
  49. data/app/commands/decidim/update_notifications_settings.rb +1 -0
  50. data/app/commands/decidim/update_resources_taxonomies.rb +67 -0
  51. data/app/commands/decidim/update_user_group.rb +7 -1
  52. data/app/constraints/decidim/current_component.rb +1 -1
  53. data/app/controllers/concerns/decidim/ajax_permission_handler.rb +21 -0
  54. data/app/controllers/concerns/decidim/devise_authentication_methods.rb +3 -6
  55. data/app/controllers/concerns/decidim/devise_controllers.rb +2 -0
  56. data/app/controllers/concerns/decidim/disable_redirection_to_external_host.rb +1 -1
  57. data/app/controllers/concerns/decidim/ephemeral_session_checker.rb +87 -0
  58. data/app/controllers/concerns/decidim/filter_resource.rb +4 -2
  59. data/app/controllers/concerns/decidim/has_members_page.rb +25 -0
  60. data/app/controllers/concerns/decidim/headers/browser_feature_permissions.rb +50 -0
  61. data/app/controllers/concerns/decidim/locale_switcher.rb +2 -2
  62. data/app/controllers/concerns/decidim/needs_password_change.rb +0 -1
  63. data/app/controllers/concerns/decidim/needs_permission.rb +2 -1
  64. data/app/controllers/concerns/decidim/needs_tos_accepted.rb +4 -5
  65. data/app/controllers/concerns/decidim/onboarding_action_methods.rb +52 -0
  66. data/app/controllers/decidim/application_controller.rb +10 -0
  67. data/app/controllers/decidim/authorization_modals_controller.rb +8 -2
  68. data/app/controllers/decidim/components/base_controller.rb +3 -7
  69. data/app/controllers/decidim/devise/confirmations_controller.rb +4 -0
  70. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +8 -1
  71. data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
  72. data/app/controllers/decidim/devise/sessions_controller.rb +2 -0
  73. data/app/controllers/decidim/download_your_data_controller.rb +33 -2
  74. data/app/controllers/decidim/editor_images_controller.rb +1 -11
  75. data/app/controllers/decidim/follows_controller.rb +1 -1
  76. data/app/controllers/decidim/geolocation_controller.rb +19 -0
  77. data/app/controllers/decidim/homepage_controller.rb +0 -1
  78. data/app/controllers/decidim/open_data_controller.rb +33 -8
  79. data/app/controllers/decidim/user_conversations_controller.rb +1 -11
  80. data/app/events/decidim/soft_delete_resource_event.rb +15 -0
  81. data/app/forms/decidim/amendable/form.rb +4 -2
  82. data/app/forms/decidim/ephemeral_user_form.rb +22 -0
  83. data/app/forms/decidim/notifications_settings_form.rb +1 -0
  84. data/app/forms/decidim/omniauth_registration_form.rb +14 -1
  85. data/app/helpers/concerns/decidim/flash_helper_extensions.rb +17 -2
  86. data/app/helpers/decidim/action_authorization_helper.rb +75 -14
  87. data/app/helpers/decidim/amendments_helper.rb +0 -9
  88. data/app/helpers/decidim/application_helper.rb +6 -2
  89. data/app/helpers/decidim/breadcrumb_helper.rb +6 -0
  90. data/app/helpers/decidim/cache_helper.rb +1 -1
  91. data/app/helpers/decidim/check_boxes_tree_helper.rb +25 -53
  92. data/app/helpers/decidim/decidim_form_helper.rb +0 -44
  93. data/app/helpers/decidim/endorsable_helper.rb +0 -10
  94. data/app/helpers/decidim/layout_helper.rb +6 -0
  95. data/app/helpers/decidim/messaging/conversation_helper.rb +2 -3
  96. data/app/helpers/decidim/meta_tags_helper.rb +32 -23
  97. data/app/helpers/decidim/modal_helper.rb +23 -0
  98. data/app/helpers/decidim/omniauth_helper.rb +5 -5
  99. data/app/helpers/decidim/onboarding_action_helper.rb +13 -0
  100. data/app/helpers/decidim/passwords_helper.rb +2 -2
  101. data/app/helpers/decidim/taxonomies_helper.rb +40 -0
  102. data/app/jobs/decidim/download_your_data_export_job.rb +2 -19
  103. data/app/jobs/decidim/event_publisher_job.rb +18 -9
  104. data/app/jobs/decidim/export_job.rb +5 -1
  105. data/app/jobs/decidim/export_participatory_space_job.rb +4 -1
  106. data/app/jobs/decidim/open_data_job.rb +4 -4
  107. data/app/mailers/decidim/export_mailer.rb +7 -12
  108. data/app/models/decidim/action_log.rb +11 -0
  109. data/app/models/decidim/category.rb +4 -0
  110. data/app/models/decidim/component.rb +25 -3
  111. data/app/models/decidim/metric.rb +2 -1
  112. data/app/models/decidim/moderation.rb +16 -0
  113. data/app/models/decidim/newsletter.rb +12 -8
  114. data/app/models/decidim/organization.rb +7 -3
  115. data/app/models/decidim/participatory_space_private_user.rb +20 -0
  116. data/app/models/decidim/private_export.rb +24 -0
  117. data/app/models/decidim/push_notification_message.rb +1 -1
  118. data/app/models/decidim/scope.rb +4 -0
  119. data/app/models/decidim/share_token.rb +36 -10
  120. data/app/models/decidim/taxonomization.rb +23 -0
  121. data/app/models/decidim/taxonomy.rb +139 -0
  122. data/app/models/decidim/taxonomy_filter.rb +130 -0
  123. data/app/models/decidim/taxonomy_filter_item.rb +33 -0
  124. data/app/models/decidim/user.rb +9 -23
  125. data/app/models/decidim/user_base_entity.rb +12 -0
  126. data/app/models/decidim/user_moderation.rb +9 -0
  127. data/app/models/decidim/user_report.rb +4 -0
  128. data/app/packs/entrypoints/decidim_core.js +1 -0
  129. data/app/packs/entrypoints/decidim_geocoding.js +2 -0
  130. data/app/packs/images/decidim/brands/facebook.svg +10 -0
  131. data/app/packs/images/decidim/brands/google.svg +7 -1
  132. data/app/packs/images/decidim/brands/twitter-x.svg +3 -0
  133. data/app/packs/src/decidim/check_boxes_tree.js +0 -1
  134. data/app/packs/src/decidim/clipboard.js +18 -9
  135. data/app/packs/src/decidim/confirm.js +79 -59
  136. data/app/packs/src/decidim/decidim_application.js +1 -0
  137. data/app/packs/src/decidim/form_remote.js +1 -1
  138. data/app/packs/src/decidim/geocoding/reverse_geocoding.js +60 -0
  139. data/app/packs/src/decidim/impersonation.js +1 -1
  140. data/app/packs/src/decidim/index.js +11 -1
  141. data/app/packs/src/decidim/onboarding_pending_action.js +24 -0
  142. data/app/packs/src/decidim/session_timeouter.js +1 -1
  143. data/app/packs/src/decidim/sticky_footer.js +29 -0
  144. data/app/packs/src/decidim/sticky_header.js +6 -31
  145. data/app/packs/src/decidim/user_registrations.js +13 -0
  146. data/app/packs/src/decidim/utilities/dom.js +148 -0
  147. data/app/packs/stylesheets/decidim/_accordion.scss +30 -0
  148. data/app/packs/stylesheets/decidim/_buttons.scss +19 -0
  149. data/app/packs/stylesheets/decidim/_dropdown.scss +1 -1
  150. data/app/packs/stylesheets/decidim/_endorsers_list.scss +26 -20
  151. data/app/packs/stylesheets/decidim/_forms.scss +2 -2
  152. data/app/packs/stylesheets/decidim/_header.scss +5 -3
  153. data/app/packs/stylesheets/decidim/_layout.scss +32 -2
  154. data/app/packs/stylesheets/decidim/_login.scss +53 -6
  155. data/app/packs/stylesheets/decidim/_modal.scss +42 -0
  156. data/app/packs/stylesheets/decidim/_modal_tos_refuse.scss +4 -0
  157. data/app/packs/stylesheets/decidim/_participatory_spaces.scss +46 -0
  158. data/app/packs/stylesheets/decidim/_profile.scss +1 -1
  159. data/app/packs/stylesheets/decidim/_success_image.scss +64 -0
  160. data/app/packs/stylesheets/decidim/_tribute.scss +36 -0
  161. data/app/packs/stylesheets/decidim/application.scss +1 -0
  162. data/app/packs/stylesheets/decidim/geocoding_addons.scss +5 -0
  163. data/app/packs/stylesheets/decidim/map.scss +7 -10
  164. data/app/packs/stylesheets/decidim/resource_history.scss +31 -0
  165. data/app/permissions/decidim/permissions.rb +8 -2
  166. data/app/presenters/decidim/admin_log/base_user_presenter.rb +67 -0
  167. data/app/presenters/decidim/admin_log/component_presenter.rb +32 -3
  168. data/app/presenters/decidim/admin_log/moderation_presenter.rb +30 -3
  169. data/app/presenters/decidim/admin_log/share_token_presenter.rb +39 -0
  170. data/app/presenters/decidim/admin_log/taxonomy_filter_presenter.rb +57 -0
  171. data/app/presenters/decidim/admin_log/taxonomy_presenter.rb +48 -0
  172. data/app/presenters/decidim/admin_log/user_group_presenter.rb +6 -6
  173. data/app/presenters/decidim/admin_log/user_presenter.rb +4 -18
  174. data/app/presenters/decidim/log/value_types/date_presenter.rb +1 -0
  175. data/app/presenters/decidim/log/value_types/taxonomy_presenter.rb +29 -0
  176. data/app/presenters/decidim/participatory_space_private_user_presenter.rb +50 -0
  177. data/app/presenters/decidim/taxonomy_filter_presenter.rb +19 -0
  178. data/app/presenters/decidim/taxonomy_presenter.rb +14 -0
  179. data/app/queries/decidim/metrics/blocked_users_metric_manage.rb +2 -2
  180. data/app/queries/decidim/metrics/users_metric_manage.rb +2 -2
  181. data/app/queries/decidim/public_activities.rb +1 -12
  182. data/app/queries/decidim/stats_users_count.rb +2 -2
  183. data/app/resolvers/decidim/meta_image_url_resolver.rb +128 -0
  184. data/app/serializers/decidim/exporters/open_data_blocked_user_serializer.rb +25 -0
  185. data/app/serializers/decidim/exporters/open_data_metric_serializer.rb +22 -0
  186. data/app/serializers/decidim/exporters/open_data_moderation_serializer.rb +30 -0
  187. data/app/serializers/decidim/exporters/open_data_taxonomy_serializer.rb +30 -0
  188. data/app/serializers/decidim/exporters/open_data_user_group_serializer.rb +38 -0
  189. data/app/serializers/decidim/exporters/open_data_user_serializer.rb +39 -0
  190. data/app/serializers/decidim/exporters/participatory_space_serializer.rb +104 -0
  191. data/app/serializers/decidim/exporters/serializer.rb +25 -0
  192. data/app/serializers/decidim/schema_org_breadcrumb_list_serializer.rb +52 -0
  193. data/app/services/decidim/action_authorizer.rb +32 -3
  194. data/app/services/decidim/base_diff_renderer.rb +1 -1
  195. data/app/services/decidim/download_your_data_exporter.rb +58 -24
  196. data/app/services/decidim/onboarding_manager.rb +272 -0
  197. data/app/services/decidim/open_data_exporter.rb +139 -13
  198. data/app/services/decidim/traceability.rb +13 -0
  199. data/app/uploaders/decidim/application_uploader.rb +1 -1
  200. data/app/validators/etiquette_validator.rb +9 -2
  201. data/app/validators/passthru_validator.rb +1 -1
  202. data/app/validators/translated_etiquette_validator.rb +32 -0
  203. data/app/views/decidim/account/_password_fields.html.erb +2 -2
  204. data/app/views/decidim/application/_accordion_section.html.erb +14 -0
  205. data/app/views/decidim/application/_collection.html.erb +30 -18
  206. data/app/views/decidim/devise/omniauth_registrations/new.html.erb +5 -1
  207. data/app/views/decidim/devise/omniauth_registrations/new_tos_fields.html.erb +29 -0
  208. data/app/views/decidim/devise/registrations/new.html.erb +10 -22
  209. data/app/views/decidim/devise/sessions/new.html.erb +24 -29
  210. data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +2 -4
  211. data/app/views/decidim/devise/shared/_tos_fields.html.erb +16 -0
  212. data/app/views/decidim/download_your_data/_export.html.erb +15 -0
  213. data/app/views/decidim/download_your_data/show.html.erb +51 -5
  214. data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +16 -19
  215. data/app/views/decidim/export_mailer/download_your_data_export.html.erb +2 -2
  216. data/app/views/decidim/export_mailer/export.html.erb +5 -1
  217. data/app/views/decidim/notifications_settings/show.html.erb +22 -0
  218. data/app/views/decidim/open_data/_how_to_open_accordion_section.html.erb +15 -0
  219. data/app/views/decidim/open_data/index.html.erb +108 -0
  220. data/app/views/decidim/pages/show.html.erb +2 -1
  221. data/app/views/decidim/participatory_space_private_users/_participatory_space_private_user.html.erb +1 -0
  222. data/app/views/decidim/shared/_login_modal.html.erb +26 -20
  223. data/app/views/decidim/shared/_resource_actions.html.erb +21 -0
  224. data/app/views/decidim/shared/filters/_check_boxes_tree.html.erb +1 -2
  225. data/app/views/decidim/shared/filters/_collection.html.erb +1 -1
  226. data/app/views/decidim/shared/filters/_dropdown_label.html.erb +7 -4
  227. data/app/views/layouts/decidim/_application.html.erb +0 -1
  228. data/app/views/layouts/decidim/_js_configuration.html.erb +1 -0
  229. data/app/views/layouts/decidim/_logo.html.erb +1 -1
  230. data/app/views/layouts/decidim/_logo_mobile.html.erb +1 -1
  231. data/app/views/layouts/decidim/_meta_tags_config.html.erb +6 -11
  232. data/app/views/layouts/decidim/_schema_org_breadcrumb_list.html.erb +3 -0
  233. data/app/views/layouts/decidim/_wrapper.html.erb +15 -9
  234. data/app/views/layouts/decidim/footer/_main_links.html.erb +1 -1
  235. data/app/views/layouts/decidim/header/_close_ephemeral_session.html.erb +25 -0
  236. data/app/views/layouts/decidim/header/_main.html.erb +14 -10
  237. data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
  238. data/app/views/layouts/decidim/shared/_layout_item.html.erb +1 -1
  239. data/config/assets.rb +2 -1
  240. data/config/locales/ar.yml +27 -59
  241. data/config/locales/bg.yml +3 -64
  242. data/config/locales/ca.yml +367 -60
  243. data/config/locales/cs.yml +364 -55
  244. data/config/locales/de.yml +354 -54
  245. data/config/locales/el.yml +1 -48
  246. data/config/locales/en.yml +361 -54
  247. data/config/locales/eo.yml +0 -2
  248. data/config/locales/es-MX.yml +361 -57
  249. data/config/locales/es-PY.yml +361 -57
  250. data/config/locales/es.yml +364 -57
  251. data/config/locales/eu.yml +364 -57
  252. data/config/locales/fi-plain.yml +357 -57
  253. data/config/locales/fi.yml +361 -58
  254. data/config/locales/fr-CA.yml +176 -54
  255. data/config/locales/fr.yml +177 -52
  256. data/config/locales/ga-IE.yml +0 -21
  257. data/config/locales/gl.yml +1 -34
  258. data/config/locales/hu.yml +1 -53
  259. data/config/locales/id-ID.yml +1 -34
  260. data/config/locales/is-IS.yml +0 -16
  261. data/config/locales/it.yml +5 -60
  262. data/config/locales/ja.yml +215 -56
  263. data/config/locales/lb.yml +1 -52
  264. data/config/locales/lt.yml +1 -59
  265. data/config/locales/lv.yml +1 -40
  266. data/config/locales/nl.yml +1 -53
  267. data/config/locales/no.yml +2 -52
  268. data/config/locales/pl.yml +4 -66
  269. data/config/locales/pt-BR.yml +11 -52
  270. data/config/locales/pt.yml +2 -52
  271. data/config/locales/ro-RO.yml +195 -117
  272. data/config/locales/ru.yml +0 -20
  273. data/config/locales/sk.yml +1 -41
  274. data/config/locales/sv.yml +103 -59
  275. data/config/locales/tr-TR.yml +1 -50
  276. data/config/locales/uk.yml +0 -18
  277. data/config/locales/zh-CN.yml +1 -50
  278. data/config/locales/zh-TW.yml +1 -54
  279. data/config/routes.rb +4 -10
  280. data/db/migrate/20181025082245_add_timestamps_to_components.rb +2 -0
  281. data/db/migrate/20240628111905_add_visible_to_components.rb +7 -0
  282. data/db/migrate/20240704115429_create_decidim_taxonomies.rb +23 -0
  283. data/db/migrate/20240717093514_add_registered_only_to_decidim_share_tokens.rb +7 -0
  284. data/db/migrate/20240722215500_change_object_changes_on_versions.rb +39 -0
  285. data/db/migrate/20240806065417_create_decidim_taxonomy_filters.rb +23 -0
  286. data/db/migrate/20240822161348_add_deleted_at_to_decidim_components.rb +8 -0
  287. data/db/migrate/20240906162524_add_part_of_to_taxonomies.rb +26 -0
  288. data/db/migrate/20241001135825_add_role_to_participatory_space_private_users.rb +7 -0
  289. data/db/migrate/20241001140408_add_published_to_participatory_space_private_users.rb +7 -0
  290. data/db/migrate/20241022002600_create_private_exports.rb +18 -0
  291. data/db/migrate/20241028114430_add_component_counter_to_taxonomy_filters.rb +7 -0
  292. data/db/migrate/20241111104357_add_names_and_space_boolean_to_taxonomy_filters.rb +9 -0
  293. data/db/migrate/20241127093708_add_taxonomy_to_metrics.rb +7 -0
  294. data/db/migrate/20241204121445_add_participatory_space_manifests_from_taxonomy_filters.rb +9 -0
  295. data/decidim-core.gemspec +14 -17
  296. data/lib/decidim/action_authorization.rb +3 -2
  297. data/lib/decidim/amendable.rb +1 -1
  298. data/lib/decidim/api/input_filters/category_input_filter.rb +5 -3
  299. data/lib/decidim/api/input_filters/component_input_filter.rb +33 -20
  300. data/lib/decidim/api/input_filters/user_entity_input_filter.rb +53 -44
  301. data/lib/decidim/api/input_sorts/component_input_sort.rb +15 -13
  302. data/lib/decidim/api/input_sorts/user_entity_input_sort.rb +4 -4
  303. data/lib/decidim/api/interfaces/author_interface.rb +3 -2
  304. data/lib/decidim/api/interfaces/coauthorable_interface.rb +5 -5
  305. data/lib/decidim/api/interfaces/endorsable_interface.rb +2 -2
  306. data/lib/decidim/api/interfaces/participatory_space_interface.rb +5 -10
  307. data/lib/decidim/api/interfaces/taxonomizable_interface.rb +13 -0
  308. data/lib/decidim/api/types/amendment_type.rb +5 -7
  309. data/lib/decidim/api/types/area_api_type.rb +3 -3
  310. data/lib/decidim/api/types/attachment_type.rb +3 -3
  311. data/lib/decidim/api/types/category_type.rb +2 -2
  312. data/lib/decidim/api/types/decidim_type.rb +5 -1
  313. data/lib/decidim/api/types/fingerprint_type.rb +1 -1
  314. data/lib/decidim/api/types/localized_string_type.rb +1 -1
  315. data/lib/decidim/api/types/metric_history_type.rb +2 -0
  316. data/lib/decidim/api/types/metric_type.rb +1 -1
  317. data/lib/decidim/api/types/organization_type.rb +5 -0
  318. data/lib/decidim/api/types/participatory_space_link_type.rb +2 -2
  319. data/lib/decidim/api/types/participatory_space_manifest_type.rb +1 -1
  320. data/lib/decidim/api/types/quantifiable_translated_field_type.rb +1 -1
  321. data/lib/decidim/api/types/scope_api_type.rb +2 -3
  322. data/lib/decidim/api/types/session_type.rb +1 -2
  323. data/lib/decidim/api/types/taxonomy_type.rb +15 -0
  324. data/lib/decidim/api/types/trace_version_type.rb +2 -2
  325. data/lib/decidim/api/types/translated_field_type.rb +3 -5
  326. data/lib/decidim/api/types/user_group_type.rb +7 -20
  327. data/lib/decidim/api/types/user_type.rb +7 -20
  328. data/lib/decidim/asset_router/storage.rb +4 -4
  329. data/lib/decidim/assets/tailwind/tailwind.config.js.erb +2 -1
  330. data/lib/decidim/attachment_attributes.rb +1 -1
  331. data/lib/decidim/attribute_encryptor.rb +1 -1
  332. data/lib/decidim/attribute_object/nested_validator.rb +1 -1
  333. data/lib/decidim/attributes/integer_with_units.rb +27 -0
  334. data/lib/decidim/attributes.rb +2 -0
  335. data/lib/decidim/authorization_form_builder.rb +0 -7
  336. data/lib/decidim/coauthorable.rb +1 -1
  337. data/lib/decidim/command.rb +3 -3
  338. data/lib/decidim/commands/destroy_resource.rb +5 -1
  339. data/lib/decidim/commands/resource_handler.rb +2 -2
  340. data/lib/decidim/commands/restore_resource.rb +45 -0
  341. data/lib/decidim/commands/soft_delete_resource.rb +63 -0
  342. data/lib/decidim/component_manifest.rb +7 -0
  343. data/lib/decidim/core/api.rb +2 -0
  344. data/lib/decidim/core/engine.rb +21 -7
  345. data/lib/decidim/core/menu.rb +0 -5
  346. data/lib/decidim/core/seeds.rb +42 -2
  347. data/lib/decidim/core/test/factories.rb +105 -2
  348. data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +85 -0
  349. data/lib/decidim/core/test/shared_examples/comments_examples.rb +393 -38
  350. data/lib/decidim/core/test/shared_examples/components_controller_hide_shared_examples.rb +11 -0
  351. data/lib/decidim/core/test/shared_examples/components_controller_reorder_shared_examples.rb +21 -0
  352. data/lib/decidim/core/test/shared_examples/download_open_data_shared_context.rb +36 -0
  353. data/lib/decidim/core/test/shared_examples/download_open_data_shared_examples.rb +45 -0
  354. data/lib/decidim/core/test/shared_examples/download_your_data_shared_examples.rb +17 -0
  355. data/lib/decidim/core/test/shared_examples/etiquette_validator_examples.rb +25 -0
  356. data/lib/decidim/core/test/shared_examples/follows_examples.rb +43 -0
  357. data/lib/decidim/core/test/shared_examples/has_taxonomies.rb +94 -0
  358. data/lib/decidim/core/test/shared_examples/manage_share_tokens_examples.rb +237 -0
  359. data/lib/decidim/core/test/shared_examples/map_examples.rb +2 -0
  360. data/lib/decidim/core/test/shared_examples/open_data_exporter_examples.rb +102 -0
  361. data/lib/decidim/core/test/shared_examples/participatory_space_members_page_examples.rb +46 -0
  362. data/lib/decidim/core/test/shared_examples/participatory_space_search_examples.rb +98 -0
  363. data/lib/decidim/core/test/shared_examples/permissions.rb +7 -7
  364. data/lib/decidim/core/test/shared_examples/preview_with_share_token_examples.rb +94 -0
  365. data/lib/decidim/core/test/shared_examples/reports_examples.rb +9 -5
  366. data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +2 -2
  367. data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +75 -69
  368. data/lib/decidim/core/test/shared_examples/searchable_resources_shared_context.rb +1 -1
  369. data/lib/decidim/core/test/shared_examples/simple_event.rb +33 -19
  370. data/lib/decidim/core/test/shared_examples/social_share_examples.rb +25 -0
  371. data/lib/decidim/core/test/shared_examples/softdeleteable_components_examples.rb +173 -0
  372. data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +54 -8
  373. data/lib/decidim/core/test/shared_examples/taxonomizable_interface_examples.rb +20 -0
  374. data/lib/decidim/core/test/shared_examples/taxonomizable_resource_examples.rb +37 -0
  375. data/lib/decidim/core/test/shared_examples/taxonomy_settings.rb +49 -0
  376. data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +1 -1
  377. data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +2 -2
  378. data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +1 -1
  379. data/lib/decidim/core/test.rb +9 -5
  380. data/lib/decidim/core/version.rb +1 -1
  381. data/lib/decidim/core.rb +58 -0
  382. data/lib/decidim/download_your_data_serializers/download_your_data_identity_serializer.rb +0 -4
  383. data/lib/decidim/download_your_data_serializers/download_your_data_participatory_space_private_user_serializer.rb +3 -1
  384. data/lib/decidim/download_your_data_serializers/download_your_data_report_serializer.rb +2 -1
  385. data/lib/decidim/download_your_data_serializers/download_your_data_user_serializer.rb +6 -7
  386. data/lib/decidim/download_your_data_serializers.rb +19 -0
  387. data/lib/decidim/exporters/csv.rb +6 -0
  388. data/lib/decidim/exporters/export_manifest.rb +14 -0
  389. data/lib/decidim/exporters/pdf.rb +26 -22
  390. data/lib/decidim/filter_form_builder.rb +12 -15
  391. data/lib/decidim/form_builder.rb +6 -129
  392. data/lib/decidim/has_category.rb +5 -1
  393. data/lib/decidim/has_private_users.rb +4 -0
  394. data/lib/decidim/has_taxonomy_settings.rb +47 -0
  395. data/lib/decidim/has_upload_validations.rb +1 -1
  396. data/lib/decidim/legacy_form_builder.rb +118 -0
  397. data/lib/decidim/maintenance/import_models/application_record.rb +93 -0
  398. data/lib/decidim/maintenance/import_models/area.rb +82 -0
  399. data/lib/decidim/maintenance/import_models/area_type.rb +12 -0
  400. data/lib/decidim/maintenance/import_models/assembly_type.rb +49 -0
  401. data/lib/decidim/maintenance/import_models/categorization.rb +14 -0
  402. data/lib/decidim/maintenance/import_models/category.rb +107 -0
  403. data/lib/decidim/maintenance/import_models/participatory_process_type.rb +21 -0
  404. data/lib/decidim/maintenance/import_models/scope.rb +163 -0
  405. data/lib/decidim/maintenance/import_models.rb +19 -0
  406. data/lib/decidim/maintenance/taxonomy_importer.rb +132 -0
  407. data/lib/decidim/maintenance/taxonomy_plan.rb +78 -0
  408. data/lib/decidim/maintenance.rb +12 -0
  409. data/lib/decidim/map/autocomplete.rb +52 -8
  410. data/lib/decidim/map/dynamic_map.rb +1 -1
  411. data/lib/decidim/map/provider/geocoding/here.rb +9 -3
  412. data/lib/decidim/map.rb +3 -6
  413. data/lib/decidim/moderation_tools.rb +14 -3
  414. data/lib/decidim/newsletter_encryptor.rb +1 -1
  415. data/lib/decidim/paddable.rb +1 -1
  416. data/lib/decidim/participable.rb +10 -10
  417. data/lib/decidim/participatory_space_user.rb +10 -0
  418. data/lib/decidim/private_download_helper.rb +15 -0
  419. data/lib/decidim/record_encryptor.rb +51 -46
  420. data/lib/decidim/resourceable.rb +16 -0
  421. data/lib/decidim/seeds.rb +18 -20
  422. data/lib/decidim/settings_manifest.rb +34 -1
  423. data/lib/decidim/soft_deletable.rb +17 -0
  424. data/lib/decidim/taxonomizable.rb +72 -0
  425. data/lib/decidim/view_model.rb +0 -1
  426. data/lib/tasks/decidim_download_your_data_tasks.rake +2 -4
  427. data/lib/tasks/decidim_procfile.rake +6 -0
  428. data/lib/tasks/decidim_tasks.rake +1 -0
  429. data/lib/tasks/decidim_taxonomies.rake +155 -0
  430. data/lib/tasks/upgrade/{decidim_fix_categorization.rake → clean.rake} +25 -18
  431. data/lib/tasks/upgrade/decidim_active_storage_migration_tasks.rake +1 -1
  432. data/lib/tasks/upgrade/migrations.rake +91 -0
  433. metadata +195 -102
  434. data/app/cells/decidim/amendable/amenders_list/show.erb +0 -0
  435. data/app/cells/decidim/content_blocks/base/content.erb +0 -0
  436. data/app/cells/decidim/endorsers_list/full_endorsers_list.erb +0 -3
  437. data/app/cells/decidim/endorsers_list_button/content.erb +0 -1
  438. data/app/cells/decidim/endorsers_list_button_cell.rb +0 -15
  439. data/app/cells/decidim/scopes_picker/scope_picker_prompt.erb +0 -3
  440. data/app/cells/decidim/scopes_picker/scope_picker_values.erb +0 -5
  441. data/app/cells/decidim/scopes_picker/show.erb +0 -14
  442. data/app/cells/decidim/scopes_picker_cell.rb +0 -92
  443. data/app/commands/decidim/update_user_interests.rb +0 -41
  444. data/app/controllers/decidim/scopes_controller.rb +0 -84
  445. data/app/controllers/decidim/user_interests_controller.rb +0 -30
  446. data/app/forms/decidim/user_interest_scope_form.rb +0 -25
  447. data/app/forms/decidim/user_interests_form.rb +0 -17
  448. data/app/helpers/decidim/categories_helper.rb +0 -26
  449. data/app/helpers/decidim/scopes_helper.rb +0 -105
  450. data/app/packs/images/decidim/vendor/leaflet/layers-2x.png +0 -0
  451. data/app/packs/images/decidim/vendor/leaflet/layers.png +0 -0
  452. data/app/packs/images/decidim/vendor/leaflet/marker-icon-2x.png +0 -0
  453. data/app/packs/images/decidim/vendor/leaflet/marker-icon.png +0 -0
  454. data/app/packs/images/decidim/vendor/leaflet/marker-shadow.png +0 -0
  455. data/app/packs/stylesheets/decidim/legacy/MarkerCluster.Default.scss +0 -67
  456. data/app/packs/stylesheets/decidim/legacy/MarkerCluster.scss +0 -18
  457. data/app/packs/stylesheets/decidim/legacy/leaflet.scss +0 -705
  458. data/app/validators/scope_belongs_to_component_validator.rb +0 -16
  459. data/app/views/decidim/account/_user_groups.html.erb +0 -0
  460. data/app/views/decidim/scopes/_scopes_picker_input.html.erb +0 -19
  461. data/app/views/decidim/scopes/picker.html.erb +0 -53
  462. data/app/views/decidim/shared/_comments.html.erb +0 -0
  463. data/app/views/decidim/shared/_share_modal.html.erb +0 -26
  464. data/app/views/decidim/shared/_tags.html.erb +0 -1
  465. data/app/views/decidim/user_interests/_areas.html.erb +0 -14
  466. data/app/views/decidim/user_interests/_scopes.html.erb +0 -22
  467. data/app/views/decidim/user_interests/show.html.erb +0 -22
  468. data/config/initializers/foundation_rails_helper.rb +0 -4
  469. data/lib/decidim/core/test/shared_examples/has_category.rb +0 -38
  470. data/lib/decidim/core/test/shared_examples/has_scope.rb +0 -11
  471. data/lib/decidim/core/test/shared_examples/manage_component_share_tokens.rb +0 -83
  472. data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +0 -49
  473. data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +0 -93
  474. data/lib/decidim/seven_zip_wrapper.rb +0 -29
@@ -9,11 +9,11 @@ module Decidim
9
9
 
10
10
  field :endorsements, [Decidim::Core::AuthorInterface, { null: true }], "The endorsements of this object.", null: false
11
11
 
12
+ field :endorsements_count, Integer, description: "The total amount of endorsements the object has received", null: true
13
+
12
14
  def endorsements
13
15
  object.endorsements.map(&:normalized_author)
14
16
  end
15
-
16
- field :endorsements_count, Integer, description: "The total amount of endorsements the object has received", null: true
17
17
  end
18
18
  end
19
19
  end
@@ -8,11 +8,13 @@ module Decidim
8
8
  description "The interface that all participatory spaces should implement."
9
9
 
10
10
  field :id, GraphQL::Types::ID, "The participatory space's unique ID", null: false
11
-
11
+ field :components, [ComponentInterface, { null: true }], null: true, description: "Lists the components this space contains." do
12
+ argument :filter, ComponentInputFilter, "Provides several methods to filter the results", required: false
13
+ argument :order, ComponentInputSort, "Provides several methods to order the results", required: false
14
+ end
15
+ field :stats, [Decidim::Core::StatisticType, { null: true }], "The statistics collection of this participatory space", null: true
12
16
  field :title, TranslatedFieldType, "The graphql_name of this participatory space.", null: false
13
-
14
17
  field :type, String, description: "The participatory space class name. i.e. Decidim::ParticipatoryProcess", null: false
15
-
16
18
  field :manifest, Decidim::Core::ParticipatorySpaceManifestType, description: "The manifest information for the participatory space.", null: false
17
19
 
18
20
  def type
@@ -23,17 +25,10 @@ module Decidim
23
25
  ParticipatorySpaceManifestPresenter.new(object.manifest, object.organization)
24
26
  end
25
27
 
26
- field :components, [ComponentInterface, { null: true }], null: true, description: "Lists the components this space contains." do
27
- argument :filter, ComponentInputFilter, "Provides several methods to filter the results", required: false
28
- argument :order, ComponentInputSort, "Provides several methods to order the results", required: false
29
- end
30
-
31
28
  def components(filter: {}, order: {})
32
29
  ComponentList.new.call(object, { filter:, order: }, context)
33
30
  end
34
31
 
35
- field :stats, [Decidim::Core::StatisticType, { null: true }], null: true
36
-
37
32
  def stats
38
33
  return if object.respond_to?(:show_statistics) && !object.show_statistics
39
34
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ # This interface represents a categorizable object.
6
+ module TaxonomizableInterface
7
+ include Decidim::Api::Types::BaseInterface
8
+ description "An interface that can be used in taxonomizable objects."
9
+
10
+ field :taxonomies, [Decidim::Core::TaxonomyType], "The object's taxonomies", null: true
11
+ end
12
+ end
13
+ end
@@ -5,15 +5,13 @@ module Decidim
5
5
  class AmendmentType < Decidim::Api::Types::BaseObject
6
6
  description "An amendment"
7
7
 
8
- field :id, GraphQL::Types::ID, "The id of this amendment", null: false
9
- field :state, GraphQL::Types::String, "The status of this amendment", null: false
10
- field :amender, Decidim::Core::AuthorInterface, "The author of this amendment", null: false
11
-
12
- field :amendable_type, GraphQL::Types::String, method: :decidim_amendable_type, description: "Type of the amendable object", null: false
13
- field :emendation_type, GraphQL::Types::String, method: :decidim_emendation_type, description: "Type of the emendation object", null: false
14
-
15
8
  field :amendable, AmendableEntityInterface, "The original amended resource (currently, a proposal only)", null: false
9
+ field :amendable_type, GraphQL::Types::String, method: :decidim_amendable_type, description: "Type of the amendable object", null: false
10
+ field :amender, Decidim::Core::AuthorInterface, "The author of this amendment", null: false
16
11
  field :emendation, AmendableEntityInterface, "The emendation (currently, a proposal only)", null: false
12
+ field :emendation_type, GraphQL::Types::String, method: :decidim_emendation_type, description: "Type of the emendation object", null: false
13
+ field :id, GraphQL::Types::ID, "The id of this amendment", null: false
14
+ field :state, GraphQL::Types::String, "The status of this amendment", null: false
17
15
  end
18
16
  end
19
17
  end
@@ -3,14 +3,14 @@
3
3
  module Decidim
4
4
  module Core
5
5
  class AreaApiType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::TimestampsInterface
7
+
6
8
  graphql_name "Area"
7
9
  description "An area."
8
10
 
11
+ field :area_type, Decidim::Core::AreaTypeType, "The area type of this area", null: true
9
12
  field :id, GraphQL::Types::ID, "Internal ID for this area", null: false
10
13
  field :name, Decidim::Core::TranslatedFieldType, "The graphql_name of this area.", null: false
11
- field :area_type, Decidim::Core::AreaTypeType, "The area type of this area", null: true
12
- field :created_at, Decidim::Core::DateTimeType, "The time this assembly was created", null: false
13
- field :updated_at, Decidim::Core::DateTimeType, "The time this assembly was updated", null: false
14
14
  end
15
15
  end
16
16
  end
@@ -5,11 +5,11 @@ module Decidim
5
5
  class AttachmentType < Decidim::Api::Types::BaseObject
6
6
  description "A file attachment"
7
7
 
8
- field :title, Decidim::Core::TranslatedFieldType, "The title of this attachment.", null: false
9
8
  field :description, Decidim::Core::TranslatedFieldType, "The description of this attachment.", null: false
10
- field :url, GraphQL::Types::String, "The url of this attachment", null: false
11
- field :type, GraphQL::Types::String, "The type of this attachment", method: :file_type, null: false
12
9
  field :thumbnail, GraphQL::Types::String, "A thumbnail of this attachment, if it is an image.", method: :thumbnail_url, null: true
10
+ field :title, Decidim::Core::TranslatedFieldType, "The title of this attachment.", null: false
11
+ field :type, GraphQL::Types::String, "The type of this attachment", method: :file_type, null: false
12
+ field :url, GraphQL::Types::String, "The url of this attachment", null: false
13
13
  end
14
14
  end
15
15
  end
@@ -5,10 +5,10 @@ module Decidim
5
5
  class CategoryType < Decidim::Api::Types::BaseObject
6
6
  description "A category that can be applied to other resources."
7
7
 
8
- field :id, GraphQL::Types::ID, null: false
8
+ field :id, GraphQL::Types::ID, "The id for this category", null: false
9
9
  field :name, Decidim::Core::TranslatedFieldType, "The name of this category.", null: false
10
- field :subcategories, [Decidim::Core::CategoryType, { null: true }], "Subcategories of this category.", null: false
11
10
  field :parent, Decidim::Core::CategoryType, "This category's parent category.", null: true
11
+ field :subcategories, [Decidim::Core::CategoryType, { null: true }], "Subcategories of this category.", null: false
12
12
  end
13
13
  end
14
14
  end
@@ -6,8 +6,12 @@ module Decidim
6
6
  class DecidimType < Decidim::Api::Types::BaseObject
7
7
  description "Decidim's framework-related properties."
8
8
 
9
- field :version, GraphQL::Types::String, "The current decidim's version of this deployment.", null: false
10
9
  field :application_name, GraphQL::Types::String, "The current installation's name.", null: false
10
+ field :version, GraphQL::Types::String, "The current decidim's version of this deployment.", null: true
11
+
12
+ def version
13
+ object.version if Decidim::Api.disclose_system_version
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -5,8 +5,8 @@ module Decidim
5
5
  class FingerprintType < Decidim::Api::Types::BaseObject
6
6
  description "A fingerprint object"
7
7
 
8
- field :value, GraphQL::Types::String, "The the hash value for the fingerprint", null: false
9
8
  field :source, GraphQL::Types::String, description: "Returns the source String (usually a json) from which the fingerprint is generated.", null: false
9
+ field :value, GraphQL::Types::String, "The the hash value for the fingerprint", null: false
10
10
  end
11
11
  end
12
12
  end
@@ -7,8 +7,8 @@ module Decidim
7
7
  description "Represents a particular translation of a LocalizedStringType"
8
8
 
9
9
  field :locale, GraphQL::Types::String, "The standard locale of this translation.", null: false
10
- field :text, GraphQL::Types::String, "The content of this translation.", null: true
11
10
  field :machine_translated, GraphQL::Types::Boolean, "Whether this string is machine translated or not.", null: false
11
+ field :text, GraphQL::Types::String, "The content of this translation.", null: true
12
12
 
13
13
  def machine_translated
14
14
  if object.respond_to?(:machine_translated)
@@ -3,6 +3,8 @@
3
3
  module Decidim
4
4
  module Core
5
5
  class MetricHistoryType < Decidim::Api::Types::BaseObject
6
+ description "A metric history"
7
+
6
8
  field :key, GraphQL::Types::String, "The key value", null: false
7
9
  field :value, GraphQL::Types::Int, "The value for each key", null: false
8
10
 
@@ -5,9 +5,9 @@ module Decidim
5
5
  class MetricType < Decidim::Api::Types::BaseObject
6
6
  description "Metric data"
7
7
 
8
- field :name, GraphQL::Types::String, "The graphql_name of the metric", null: false
9
8
  field :count, GraphQL::Types::Int, "The last value of the metric", null: false
10
9
  field :history, [MetricHistoryType, { null: true }], "The historic values for this metric", null: false
10
+ field :name, GraphQL::Types::String, "The graphql_name of the metric", null: false
11
11
  end
12
12
  end
13
13
  end
@@ -6,12 +6,17 @@ module Decidim
6
6
  description "The current organization"
7
7
 
8
8
  field :name, Decidim::Core::TranslatedFieldType, "The name of the current organization", null: true
9
+ field :taxonomies, [Decidim::Core::TaxonomyType, { null: true }], "The taxonomies associated to this organization", null: true
9
10
 
10
11
  field :stats, [Core::StatisticType, { null: true }], description: "The statistics associated to this object", null: true
11
12
 
12
13
  def stats
13
14
  Decidim.stats.with_context(object)
14
15
  end
16
+
17
+ def taxonomies
18
+ object.taxonomies.roots
19
+ end
15
20
  end
16
21
  end
17
22
  end
@@ -5,11 +5,11 @@ module Decidim
5
5
  class ParticipatorySpaceLinkType < Decidim::Api::Types::BaseObject
6
6
  description "A link representation between participatory spaces"
7
7
 
8
- field :id, GraphQL::Types::ID, "The id of this participatory space link", null: false
9
8
  field :from_type, GraphQL::Types::String, "The origin participatory space type for this participatory space link", null: false
10
- field :to_type, GraphQL::Types::String, "The destination participatory space type for this participatory space link", null: false
9
+ field :id, GraphQL::Types::ID, "The id of this participatory space link", null: false
11
10
  field :name, GraphQL::Types::String, "The name (purpose) of this participatory space link", null: false
12
11
  field :participatory_space, ParticipatorySpaceInterface, description: "The linked participatory space (polymorphic)", null: false
12
+ field :to_type, GraphQL::Types::String, "The destination participatory space type for this participatory space link", null: false
13
13
 
14
14
  def participatory_space
15
15
  manifest_name = object.name.partition("included_").last
@@ -5,8 +5,8 @@ module Decidim
5
5
  class ParticipatorySpaceManifestType < Decidim::Api::Types::BaseObject
6
6
  description "A participatory manifest"
7
7
 
8
- field :name, GraphQL::Types::String, "The name of the manifest", null: false
9
8
  field :human_name, Decidim::Core::QuantifiableTranslatedFieldType, "The human readable name for the manifest", null: false
9
+ field :name, GraphQL::Types::String, "The name of the manifest", null: false
10
10
 
11
11
  def human_name
12
12
  {
@@ -5,8 +5,8 @@ module Decidim
5
5
  class QuantifiableTranslatedFieldType < Decidim::Api::Types::BaseObject
6
6
  description "A quantifiable translated field with singular and plural formats"
7
7
 
8
- field :single, Decidim::Core::TranslatedFieldType, "The singular format.", null: false
9
8
  field :plural, Decidim::Core::TranslatedFieldType, "The plural format.", null: false
9
+ field :single, Decidim::Core::TranslatedFieldType, "The singular format.", null: false
10
10
  end
11
11
  end
12
12
  end
@@ -6,10 +6,9 @@ module Decidim
6
6
  graphql_name "Scope"
7
7
  description "A scope"
8
8
 
9
- field :id, GraphQL::Types::ID, null: false
10
- field :name, Decidim::Core::TranslatedFieldType, "The graphql_name of this scope.", null: false
11
-
12
9
  field :children, [Decidim::Core::ScopeApiType, { null: true }], "Descendants of this scope", null: false
10
+ field :id, GraphQL::Types::ID, "The Id for this scope", null: false
11
+ field :name, Decidim::Core::TranslatedFieldType, "The graphql_name of this scope.", null: false
13
12
  field :parent, Decidim::Core::ScopeApiType, "This scope's parent scope.", null: true
14
13
  end
15
14
  end
@@ -7,13 +7,12 @@ module Decidim
7
7
  description "The current session"
8
8
 
9
9
  field :user, UserType, "The current user", null: true
10
+ field :verified_user_groups, [UserGroupType], "The current user verified user groups", null: false
10
11
 
11
12
  def user
12
13
  object
13
14
  end
14
15
 
15
- field :verified_user_groups, [UserGroupType], "The current user verified user groups", null: false
16
-
17
16
  def verified_user_groups
18
17
  Decidim::UserGroups::ManageableUserGroups.for(object).verified
19
18
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Core
5
+ class TaxonomyType < Decidim::Api::Types::BaseObject
6
+ description "A taxonomy that can be applied to other resources."
7
+
8
+ field :children, [Decidim::Core::TaxonomyType], "The children of this taxonomy.", null: false
9
+ field :id, GraphQL::Types::ID, "The id of this taxonomy.", null: false
10
+ field :is_root, Boolean, "Whether this taxonomy is a root taxonomy (root taxonomies have no parents).", null: false, method: :root?
11
+ field :name, Decidim::Core::TranslatedFieldType, "The name of this taxonomy.", null: false
12
+ field :parent, Decidim::Core::TaxonomyType, "The parent of this taxonomy.", null: true
13
+ end
14
+ end
15
+ end
@@ -5,15 +5,15 @@ module Decidim
5
5
  class TraceVersionType < Decidim::Api::Types::BaseObject
6
6
  description "A trace version type"
7
7
 
8
- field :id, GraphQL::Types::ID, "The ID of the version", null: false
8
+ field :changeset, GraphQL::Types::JSON, description: "Object with the changes in this version", null: true
9
9
  field :created_at, Decidim::Core::DateTimeType, description: "The date and time this version was created", null: true
10
10
  field :editor, Decidim::Core::AuthorInterface, description: "The editor/author of this version", null: true
11
+ field :id, GraphQL::Types::ID, "The ID of the version", null: false
11
12
 
12
13
  def editor
13
14
  author = Decidim.traceability.version_editor(object)
14
15
  author if author.is_a?(Decidim::User) || author.is_a?(Decidim::UserGroup)
15
16
  end
16
- field :changeset, GraphQL::Types::JSON, description: "Object with the changes in this version", null: true
17
17
 
18
18
  delegate :changeset, to: :object
19
19
  end
@@ -7,14 +7,12 @@ module Decidim
7
7
  description "A translated field"
8
8
 
9
9
  field :locales, [GraphQL::Types::String, { null: true }], description: "Lists all the locales in which this translation is available", null: true
10
-
11
- field :translations, [LocalizedStringType, { null: true }], description: "All the localized strings for this translation.", null: false do
12
- argument :locales, [GraphQL::Types::String], description: "A list of locales to scope the translations to.", required: false
13
- end
14
-
15
10
  field :translation, GraphQL::Types::String, description: "Returns a single translation given a locale.", null: true do
16
11
  argument :locale, GraphQL::Types::String, "A locale to search for", required: true
17
12
  end
13
+ field :translations, [LocalizedStringType, { null: true }], description: "All the localized strings for this translation.", null: false do
14
+ argument :locales, [GraphQL::Types::String], description: "A list of locales to scope the translations to.", required: false
15
+ end
18
16
 
19
17
  def locales
20
18
  (defined_translations.keys + machine_translations.keys).uniq
@@ -8,54 +8,41 @@ module Decidim
8
8
 
9
9
  implements Decidim::Core::AuthorInterface
10
10
 
11
+ field :avatar_url, GraphQL::Types::String, "The user's avatar url", null: false
12
+ field :badge, GraphQL::Types::String, "A badge for the user group", null: false
13
+ field :deleted, GraphQL::Types::Boolean, "Whether the user group's has been deleted or not", null: false
11
14
  field :id, GraphQL::Types::ID, "The user group's id", null: false
12
-
15
+ field :members, [Decidim::Core::UserType, { null: true }], "Members of this group", null: false, method: :accepted_users
16
+ field :members_count, GraphQL::Types::Int, "Number of members in this group", null: false
13
17
  field :name, GraphQL::Types::String, "The user group's name", null: false
14
-
15
18
  field :nickname, GraphQL::Types::String, "The user group nickname", null: false
19
+ field :organization_name, Decidim::Core::TranslatedFieldType, "The user group's organization name", null: false
20
+ field :profile_path, GraphQL::Types::String, "The user group's profile url", null: false
16
21
 
17
22
  def nickname
18
23
  object.presenter.nickname
19
24
  end
20
25
 
21
- field :avatar_url, GraphQL::Types::String, "The user's avatar url", null: false
22
-
23
26
  def avatar_url
24
27
  object.presenter.avatar_url
25
28
  end
26
29
 
27
- field :profile_path, GraphQL::Types::String, "The user group's profile url", null: false
28
-
29
30
  def profile_path
30
31
  object.presenter.profile_path
31
32
  end
32
33
 
33
- field :organization_name, Decidim::Core::TranslatedFieldType, "The user group's organization name", null: false
34
-
35
34
  def organization_name
36
35
  object.organization.name
37
36
  end
38
37
 
39
- field :deleted, GraphQL::Types::Boolean, "Whether the user group's has been deleted or not", null: false
40
-
41
38
  def deleted
42
39
  object.presenter.deleted?
43
40
  end
44
41
 
45
- field :badge, GraphQL::Types::String, "A badge for the user group", null: false
46
-
47
42
  def badge
48
43
  object.presenter.badge
49
44
  end
50
45
 
51
- field :members, [Decidim::Core::UserType, { null: true }], "Members of this group", null: false
52
-
53
- def members
54
- object.accepted_users
55
- end
56
-
57
- field :members_count, GraphQL::Types::Int, "Number of members in this group", null: false
58
-
59
46
  def members_count
60
47
  object.accepted_memberships.count
61
48
  end
@@ -8,28 +8,19 @@ module Decidim
8
8
 
9
9
  implements Decidim::Core::AuthorInterface
10
10
 
11
- field :id, GraphQL::Types::ID, "The user's id", null: false
12
-
13
- field :name, GraphQL::Types::String, "The user's name", null: false
14
-
15
- field :nickname, GraphQL::Types::String, "The user's nickname", null: false
16
-
17
11
  field :avatar_url, GraphQL::Types::String, "The user's avatar url", null: false
18
-
19
- field :profile_path, GraphQL::Types::String, "The user's profile url", null: false
20
-
12
+ field :badge, GraphQL::Types::String, "A badge for the user group", null: false
13
+ field :deleted, GraphQL::Types::Boolean, "Whether the user's account has been deleted or not", null: false
21
14
  field :direct_messages_enabled, GraphQL::Types::String,
22
15
  null: false,
23
16
  description: ["If the user making the request is logged in, it will return whether this recipient accepts a conversation or not.",
24
17
  " It will return false for non-logged requests."].join
25
-
18
+ field :groups, [Decidim::Core::UserGroupType, { null: true }], "Groups where this user belongs", null: false, method: :accepted_user_groups
19
+ field :id, GraphQL::Types::ID, "The user's id", null: false
20
+ field :name, GraphQL::Types::String, "The user's name", null: false
21
+ field :nickname, GraphQL::Types::String, "The user's nickname", null: false
26
22
  field :organization_name, Decidim::Core::TranslatedFieldType, "The user's organization name", null: false
27
-
28
- field :deleted, GraphQL::Types::Boolean, "Whether the user's account has been deleted or not", null: false
29
-
30
- field :badge, GraphQL::Types::String, "A badge for the user group", null: false
31
-
32
- field :groups, [Decidim::Core::UserGroupType, { null: true }], "Groups where this user belongs", null: false
23
+ field :profile_path, GraphQL::Types::String, "The user's profile url", null: false
33
24
 
34
25
  def nickname
35
26
  object.presenter.nickname
@@ -59,10 +50,6 @@ module Decidim
59
50
  object.presenter.badge
60
51
  end
61
52
 
62
- def groups
63
- object.accepted_user_groups
64
- end
65
-
66
53
  def self.authorized?(object, context)
67
54
  super && object.confirmed? && !object.blocked? && !object.deleted?
68
55
  end
@@ -159,7 +159,7 @@ module Decidim
159
159
  return unless blob
160
160
 
161
161
  if options[:only_path] || remote? || !asset_url_available?
162
- routes.rails_blob_url(blob, **default_options.merge(options))
162
+ routes.rails_blob_url(blob, **default_options, **options)
163
163
  else
164
164
  blob.url(**options)
165
165
  end
@@ -184,7 +184,7 @@ module Decidim
184
184
  if options[:host]
185
185
  rails_representation_url(**options)
186
186
  else
187
- representation_url(**options.merge(only_path: true))
187
+ representation_url(**options, only_path: true)
188
188
  end
189
189
  end
190
190
 
@@ -207,10 +207,10 @@ module Decidim
207
207
  # @param options The options for building the URL
208
208
  # @return [String, nil] The converted representation URL or `nil` if the
209
209
  # asset is not defined.
210
- def rails_representation_url(**options)
210
+ def rails_representation_url(**)
211
211
  return unless asset
212
212
 
213
- representation_url = routes.rails_representation_url(asset, **default_options.merge(options))
213
+ representation_url = routes.rails_representation_url(asset, **default_options, **)
214
214
 
215
215
  variation = asset.try(:variation)
216
216
  return representation_url unless variation
@@ -51,7 +51,8 @@ module.exports = {
51
51
  DEFAULT: "#F3F4F7",
52
52
  2: "#FAFBFC",
53
53
  3: "#EFEFEF",
54
- 4: "#E4EEFF99" // 60% opacity
54
+ 4: "#E4EEFF99", // 60% opacity
55
+ 5: "#E9E9E9"
55
56
  }
56
57
  },
57
58
  container: {
@@ -28,7 +28,7 @@ module Decidim
28
28
  # Returns nothing.
29
29
  def attachments_attribute(name)
30
30
  attribute name, Array[Integer]
31
- attribute "add_#{name}".to_sym, Array
31
+ attribute :"add_#{name}", Array
32
32
 
33
33
  # Define the getter method that fetches the attachment records based on
34
34
  # their types. For Strings and Integers, assumes they are IDs and will
@@ -21,7 +21,7 @@ module Decidim
21
21
  def self.cryptor
22
22
  @cryptor ||= begin
23
23
  key = ActiveSupport::KeyGenerator.new("attribute").generate_key(
24
- Rails.application.secrets.secret_key_base, ActiveSupport::MessageEncryptor.key_len
24
+ Rails.application.secret_key_base, ActiveSupport::MessageEncryptor.key_len
25
25
  )
26
26
  ActiveSupport::MessageEncryptor.new(key)
27
27
  end
@@ -7,7 +7,7 @@ module Decidim
7
7
  value = value.values if value.is_a?(Hash)
8
8
  return unless Array(value).reject { |r| valid_object?(r) }.any?
9
9
 
10
- record.errors.add(attribute, :invalid, **options.merge(value:))
10
+ record.errors.add(attribute, :invalid, **options, value:)
11
11
  end
12
12
 
13
13
  private
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Attributes
5
+ # Custom attributes value to represent an Integer with units.
6
+ class IntegerWithUnits < ActiveModel::Type::Value
7
+ def type
8
+ :"decidim/attributes/integer_with_units"
9
+ end
10
+
11
+ def cast(value)
12
+ return nil if value.nil?
13
+
14
+ case value
15
+ when ::Hash
16
+ [value["0"].to_i.abs, value["1"].to_s]
17
+ when ::Array
18
+ return value if value.size != 2
19
+
20
+ [value[0].to_i.abs, value[1].to_s]
21
+ else
22
+ value
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -13,6 +13,7 @@ module Decidim
13
13
  autoload :Model, "decidim/attributes/model"
14
14
  autoload :Symbol, "decidim/attributes/symbol"
15
15
  autoload :Integer, "decidim/attributes/integer"
16
+ autoload :IntegerWithUnits, "decidim/attributes/integer_with_units"
16
17
 
17
18
  # Base types
18
19
  ActiveModel::Type.register(:array, Decidim::Attributes::Array)
@@ -30,6 +31,7 @@ module Decidim
30
31
  ActiveModel::Type.register(:"decidim/attributes/clean_string", Decidim::Attributes::CleanString)
31
32
  ActiveModel::Type.register(:"decidim/attributes/rich_text", Decidim::Attributes::RichText)
32
33
  ActiveModel::Type.register(:"decidim/attributes/blob", Decidim::Attributes::Blob)
34
+ ActiveModel::Type.register(:"decidim/attributes/integer_with_units", Decidim::Attributes::IntegerWithUnits)
33
35
 
34
36
  ActiveModel::Type.register(:integer, Decidim::Attributes::Integer)
35
37
  end
@@ -37,7 +37,6 @@ module Decidim
37
37
 
38
38
  def input_field(name, type)
39
39
  return hidden_field(name) if name.to_s == "handler_name"
40
- return scopes_selector if name.to_s == "scope_id"
41
40
 
42
41
  case type
43
42
  when :date, :datetime, :time, :"decidim/attributes/localized_date"
@@ -47,12 +46,6 @@ module Decidim
47
46
  end
48
47
  end
49
48
 
50
- def scopes_selector
51
- return if object.user.blank?
52
-
53
- collection_select :scope_id, object.user.organization.scopes, :id, ->(scope) { translated_attribute(scope.name) }
54
- end
55
-
56
49
  def find_input_type(name)
57
50
  value_type = object.class.attribute_types[name]
58
51
 
@@ -70,7 +70,7 @@ module Decidim
70
70
  def reload(options = nil)
71
71
  remove_instance_variable(:@authors) if defined?(@authors)
72
72
  remove_instance_variable(:@notifiable_identities) if defined?(@notifiable_identities)
73
- super(options)
73
+ super
74
74
  end
75
75
 
76
76
  # Returns all the authors of a coauthorable.
@@ -22,7 +22,7 @@ module Decidim
22
22
  end
23
23
 
24
24
  def evaluate(&block)
25
- @caller = eval("self", block.binding, __FILE__, __LINE__)
25
+ @caller = block.binding.receiver
26
26
  instance_eval(&block)
27
27
  end
28
28
 
@@ -42,10 +42,10 @@ module Decidim
42
42
  @caller.respond_to?(method_name, include_private)
43
43
  end
44
44
 
45
- def with_events(with_transaction: false, &block)
45
+ def with_events(with_transaction: false, &)
46
46
  ActiveSupport::Notifications.publish("#{event_namespace}:before", **event_arguments)
47
47
 
48
- with_transaction ? transaction(&block) : yield
48
+ with_transaction ? transaction(&) : yield
49
49
 
50
50
  ActiveSupport::Notifications.publish("#{event_namespace}:after", **event_arguments)
51
51
  end
@@ -40,7 +40,11 @@ module Decidim
40
40
  current_user,
41
41
  **extra_params
42
42
  ) do
43
- resource.destroy!
43
+ if resource.respond_to?(:really_destroy!)
44
+ resource.really_destroy!
45
+ else
46
+ resource.destroy!
47
+ end
44
48
  end
45
49
  end
46
50