decidim-core 0.23.3 → 0.24.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-core might be problematic. Click here for more details.

Files changed (444) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/images/decidim/icons.svg +1 -1
  4. data/app/assets/javascripts/decidim.js.es6 +1 -0
  5. data/app/assets/javascripts/decidim/core/bundle.js +1 -1
  6. data/app/assets/javascripts/decidim/core/bundle.js.map +1 -1
  7. data/app/assets/javascripts/decidim/editor.js.es6 +15 -4
  8. data/app/assets/javascripts/decidim/editor/history_override.js.es6 +117 -0
  9. data/app/assets/javascripts/decidim/editor/linebreak_module.js.es6 +83 -0
  10. data/app/assets/javascripts/decidim/editor/modified_backspace_offset1.js.es6 +98 -0
  11. data/app/assets/javascripts/decidim/editor/modified_backspace_offset_any.js.es6 +48 -0
  12. data/app/assets/javascripts/decidim/editor/modified_backspace_utils.js.es6 +31 -0
  13. data/app/assets/javascripts/decidim/editor/modified_enter.js.es6 +118 -0
  14. data/app/assets/javascripts/decidim/form_filter.component.js.es6 +25 -0
  15. data/app/assets/javascripts/decidim/geocoding/attach_input.js.es6 +41 -4
  16. data/app/assets/javascripts/decidim/input_character_counter.js.es6 +6 -1
  17. data/app/assets/javascripts/decidim/map/controller/markers.js.es6 +27 -9
  18. data/app/assets/javascripts/decidim/session_timeouter.js.es6 +78 -0
  19. data/app/assets/stylesheets/decidim/_variables.scss +9 -0
  20. data/app/assets/stylesheets/decidim/email.scss +14 -2
  21. data/app/assets/stylesheets/decidim/extras/_external-links.scss +0 -1
  22. data/app/assets/stylesheets/decidim/extras/_process_stats.scss +1 -1
  23. data/app/assets/stylesheets/decidim/extras/_results-per-page.scss +1 -0
  24. data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +2 -2
  25. data/app/assets/stylesheets/decidim/modules/_buttons.scss +2 -2
  26. data/app/assets/stylesheets/decidim/modules/_cards.scss +18 -1
  27. data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +1 -1
  28. data/app/assets/stylesheets/decidim/modules/_comments.scss +5 -1
  29. data/app/assets/stylesheets/decidim/modules/_conference-speaker.scss +4 -3
  30. data/app/assets/stylesheets/decidim/modules/_data-picker.scss +7 -0
  31. data/app/assets/stylesheets/decidim/modules/_extra.scss +4 -0
  32. data/app/assets/stylesheets/decidim/modules/_forms.scss +4 -0
  33. data/app/assets/stylesheets/decidim/modules/_loading-spinner.scss +34 -0
  34. data/app/assets/stylesheets/decidim/modules/_modules.scss +1 -1
  35. data/app/assets/stylesheets/decidim/modules/_opinion-toggle.scss +1 -1
  36. data/app/assets/stylesheets/decidim/modules/_reveal.scss +6 -0
  37. data/app/assets/stylesheets/decidim/modules/_signup.scss +1 -0
  38. data/app/assets/stylesheets/decidim/modules/{_process-stats.scss → _space-stats.scss} +1 -1
  39. data/app/cells/decidim/activity_cell.rb +11 -8
  40. data/app/cells/decidim/announcement/show.erb +4 -4
  41. data/app/cells/decidim/announcement_cell.rb +22 -2
  42. data/app/cells/decidim/author/flag_user.erb +10 -0
  43. data/app/cells/decidim/author/profile_minicard.erb +1 -1
  44. data/app/cells/decidim/author_cell.rb +9 -1
  45. data/app/cells/decidim/card_m/top.erb +1 -1
  46. data/app/cells/decidim/card_m_cell.rb +1 -1
  47. data/app/cells/decidim/content_blocks/cta/show.erb +14 -0
  48. data/app/cells/decidim/content_blocks/cta_cell.rb +35 -0
  49. data/app/cells/decidim/content_blocks/cta_settings_form/show.erb +9 -0
  50. data/app/cells/decidim/content_blocks/cta_settings_form_cell.rb +13 -0
  51. data/app/cells/decidim/content_blocks/hero_cell.rb +14 -0
  52. data/app/cells/decidim/content_blocks/highlighted_elements/elements.erb +0 -0
  53. data/app/cells/decidim/content_blocks/highlighted_elements/heading.erb +0 -0
  54. data/app/cells/decidim/content_blocks/highlighted_elements/show.erb +4 -0
  55. data/app/cells/decidim/content_blocks/highlighted_elements_cell.rb +51 -0
  56. data/app/cells/decidim/content_blocks/highlighted_elements_settings_form/show.erb +3 -0
  57. data/app/cells/decidim/content_blocks/highlighted_elements_settings_form_cell.rb +28 -0
  58. data/app/cells/decidim/content_blocks/last_activity_cell.rb +11 -0
  59. data/app/cells/decidim/content_blocks/metrics_cell.rb +0 -6
  60. data/app/cells/decidim/content_blocks/stats_cell.rb +0 -6
  61. data/app/cells/decidim/date/show.erb +31 -0
  62. data/app/cells/decidim/date_cell.rb +50 -0
  63. data/app/cells/decidim/endorsement_buttons_cell.rb +3 -3
  64. data/app/cells/decidim/flag_modal/flag_user.erb +24 -0
  65. data/app/cells/decidim/flag_modal/show.erb +24 -0
  66. data/app/cells/decidim/flag_modal_cell.rb +25 -0
  67. data/app/cells/decidim/profile/inaccessible.erb +9 -0
  68. data/app/cells/decidim/profile_cell.rb +9 -1
  69. data/app/cells/decidim/profile_sidebar/show.erb +10 -1
  70. data/app/cells/decidim/profile_sidebar_cell.rb +1 -0
  71. data/app/cells/decidim/reported_content/show.erb +5 -0
  72. data/app/cells/decidim/reported_content_cell.rb +44 -0
  73. data/app/cells/decidim/scopes_picker/scope_picker_prompt.erb +3 -0
  74. data/app/cells/decidim/scopes_picker/scope_picker_values.erb +5 -0
  75. data/app/cells/decidim/scopes_picker/show.erb +14 -0
  76. data/app/cells/decidim/scopes_picker_cell.rb +93 -0
  77. data/app/cells/decidim/tos_page/announcement.erb +1 -1
  78. data/app/cells/decidim/tos_page/form.erb +15 -13
  79. data/app/cells/decidim/tos_page_cell.rb +10 -8
  80. data/app/cells/decidim/translation_bar_cell.rb +1 -1
  81. data/app/cells/decidim/user_conversation/conversation_header.erb +1 -1
  82. data/app/cells/decidim/user_conversations_cell.rb +1 -1
  83. data/app/commands/decidim/create_report.rb +11 -1
  84. data/app/commands/decidim/create_user_report.rb +67 -0
  85. data/app/commands/decidim/gallery_methods.rb +2 -2
  86. data/app/commands/decidim/multiple_attachments_methods.rb +14 -10
  87. data/app/commands/decidim/search.rb +5 -2
  88. data/app/commands/decidim/update_notifications_settings.rb +1 -0
  89. data/app/commands/decidim/update_user_group.rb +1 -0
  90. data/app/controllers/concerns/decidim/devise_controllers.rb +1 -0
  91. data/app/controllers/concerns/decidim/flaggable.rb +5 -1
  92. data/app/controllers/concerns/decidim/force_authentication.rb +11 -3
  93. data/app/controllers/concerns/decidim/locale_switcher.rb +5 -0
  94. data/app/controllers/concerns/decidim/needs_permission.rb +7 -1
  95. data/app/controllers/concerns/decidim/orderable.rb +3 -1
  96. data/app/controllers/concerns/decidim/user_blocked_checker.rb +26 -0
  97. data/app/controllers/decidim/application_controller.rb +22 -0
  98. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +3 -1
  99. data/app/controllers/decidim/devise/sessions_controller.rb +10 -6
  100. data/app/controllers/decidim/errors_controller.rb +1 -1
  101. data/app/controllers/decidim/locales_controller.rb +1 -1
  102. data/app/controllers/decidim/profiles_controller.rb +6 -0
  103. data/app/controllers/decidim/report_users_controller.rb +42 -0
  104. data/app/controllers/decidim/scopes_controller.rb +19 -10
  105. data/app/controllers/decidim/timeouts_controller.rb +28 -0
  106. data/app/controllers/decidim/user_activities_controller.rb +5 -0
  107. data/app/controllers/decidim/user_timeline_controller.rb +1 -0
  108. data/app/events/decidim/demoted_membership_event.rb +2 -2
  109. data/app/events/decidim/invited_to_group_event.rb +2 -2
  110. data/app/events/decidim/join_request_accepted_event.rb +2 -2
  111. data/app/events/decidim/join_request_created_event.rb +2 -2
  112. data/app/events/decidim/join_request_rejected_event.rb +2 -2
  113. data/app/events/decidim/promoted_to_admin_event.rb +2 -2
  114. data/app/events/decidim/removed_from_group_event.rb +2 -2
  115. data/app/forms/decidim/account_form.rb +1 -1
  116. data/app/forms/decidim/invite_user_form.rb +2 -2
  117. data/app/forms/decidim/messaging/conversation_form.rb +1 -1
  118. data/app/forms/decidim/messaging/message_form.rb +1 -1
  119. data/app/forms/decidim/notifications_settings_form.rb +20 -0
  120. data/app/forms/url_validator.rb +20 -0
  121. data/app/helpers/decidim/action_authorization_helper.rb +2 -0
  122. data/app/helpers/decidim/application_helper.rb +1 -2
  123. data/app/helpers/decidim/cells_helper.rb +6 -0
  124. data/app/helpers/decidim/filters_helper.rb +9 -0
  125. data/app/helpers/decidim/messaging/conversation_helper.rb +11 -1
  126. data/app/helpers/decidim/newsletters_helper.rb +7 -9
  127. data/app/helpers/decidim/scopes_helper.rb +1 -1
  128. data/app/jobs/decidim/block_user_job.rb +11 -0
  129. data/app/jobs/decidim/export_job.rb +2 -2
  130. data/app/jobs/decidim/find_and_update_descendants_job.rb +48 -0
  131. data/app/jobs/decidim/machine_translation_resource_job.rb +3 -0
  132. data/app/jobs/decidim/machine_translation_save_job.rb +29 -0
  133. data/app/jobs/decidim/update_search_indexes_job.rb +11 -0
  134. data/app/jobs/decidim/user_report_job.rb +11 -0
  135. data/app/mailers/decidim/block_user_mailer.rb +21 -0
  136. data/app/mailers/decidim/reported_mailer.rb +33 -3
  137. data/app/mailers/decidim/user_report_mailer.rb +21 -0
  138. data/app/models/decidim/area.rb +0 -1
  139. data/app/models/decidim/area_type.rb +1 -1
  140. data/app/models/decidim/attachment.rb +3 -2
  141. data/app/models/decidim/attachment_collection.rb +1 -1
  142. data/app/models/decidim/authorization.rb +4 -0
  143. data/app/models/decidim/category.rb +6 -1
  144. data/app/models/decidim/impersonation_log.rb +5 -7
  145. data/app/models/decidim/metric.rb +2 -2
  146. data/app/models/decidim/moderation.rb +12 -0
  147. data/app/models/decidim/organization.rb +5 -1
  148. data/app/models/decidim/scope.rb +5 -2
  149. data/app/models/decidim/scope_type.rb +1 -1
  150. data/app/models/decidim/share_token.rb +1 -1
  151. data/app/models/decidim/static_page.rb +11 -1
  152. data/app/models/decidim/static_page_topic.rb +4 -0
  153. data/app/models/decidim/user.rb +12 -1
  154. data/app/models/decidim/user_base_entity.rb +12 -12
  155. data/app/models/decidim/user_block.rb +10 -0
  156. data/app/models/decidim/user_group.rb +1 -0
  157. data/app/models/decidim/user_moderation.rb +22 -0
  158. data/app/models/decidim/user_report.rb +31 -0
  159. data/app/permissions/decidim/permissions.rb +1 -3
  160. data/app/permissions/decidim/report_user_permissions.rb +13 -0
  161. data/app/presenters/decidim/admin_log/impersonation_log_presenter.rb +39 -0
  162. data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -2
  163. data/app/presenters/decidim/admin_log/user_moderation_presenter.rb +63 -0
  164. data/app/presenters/decidim/admin_log/user_presenter.rb +18 -9
  165. data/app/presenters/decidim/home_stats_presenter.rb +3 -3
  166. data/app/presenters/decidim/log/diff_presenter.rb +4 -3
  167. data/app/presenters/decidim/log/resource_presenter.rb +4 -4
  168. data/app/presenters/decidim/log/user_presenter.rb +1 -1
  169. data/app/presenters/decidim/menu_presenter.rb +12 -7
  170. data/app/presenters/decidim/nil_presenter.rb +0 -2
  171. data/app/presenters/decidim/user_presenter.rb +1 -1
  172. data/app/queries/decidim/metrics/blocked_users_metric_manage.rb +26 -0
  173. data/app/queries/decidim/metrics/followers_metric_manage.rb +3 -0
  174. data/app/queries/decidim/metrics/participants_metric_manage.rb +3 -0
  175. data/app/queries/decidim/metrics/reported_users_metric_manage.rb +26 -0
  176. data/app/queries/decidim/metrics/user_reports_metric_manage.rb +26 -0
  177. data/app/services/decidim/activity_search.rb +1 -3
  178. data/app/services/decidim/base_diff_renderer.rb +1 -1
  179. data/app/services/decidim/data_portability_exporter.rb +1 -0
  180. data/app/services/decidim/email_notification_generator.rb +2 -2
  181. data/app/services/decidim/events_manager.rb +1 -1
  182. data/app/services/decidim/open_data_exporter.rb +36 -7
  183. data/app/services/decidim/zip_stream/zip_stream_writer.rb +3 -3
  184. data/app/uploaders/decidim/application_uploader.rb +22 -2
  185. data/app/uploaders/decidim/attachment_uploader.rb +2 -4
  186. data/app/uploaders/decidim/downloader.rb +9 -0
  187. data/app/uploaders/decidim/image_uploader.rb +9 -21
  188. data/app/uploaders/decidim/open_data_uploader.rb +5 -0
  189. data/app/uploaders/decidim/record_image_uploader.rb +2 -2
  190. data/app/validators/etiquette_validator.rb +0 -7
  191. data/app/validators/uploader_content_type_validator.rb +4 -2
  192. data/app/views/decidim/block_user_mailer/notify.html.erb +7 -0
  193. data/app/views/decidim/devise/confirmations/new.html.erb +1 -1
  194. data/app/views/decidim/devise/registrations/edit.html.erb +1 -1
  195. data/app/views/decidim/devise/unlocks/new.html.erb +1 -1
  196. data/app/views/decidim/messaging/conversations/_conversation.html.erb +1 -1
  197. data/app/views/decidim/messaging/conversations/_messages.html.erb +1 -1
  198. data/app/views/decidim/messaging/conversations/_show.html.erb +4 -4
  199. data/app/views/decidim/notifications_settings/show.html.erb +11 -0
  200. data/app/views/decidim/pages/_standalone.html.erb +3 -1
  201. data/app/views/decidim/reported_mailer/report.html.erb +8 -8
  202. data/app/views/decidim/shared/_check_boxes_tree.html.erb +3 -3
  203. data/app/views/decidim/shared/_component_announcement.html.erb +2 -2
  204. data/app/views/decidim/shared/participatory_space_filters/_filters.html.erb +1 -1
  205. data/app/views/decidim/user_report_mailer/notify.html.erb +7 -0
  206. data/app/views/decidim/widgets/_data_picker.html.erb +1 -1
  207. data/app/views/layouts/decidim/_application.html.erb +1 -0
  208. data/app/views/layouts/decidim/_js_configuration.html.erb +1 -1
  209. data/app/views/layouts/decidim/_main_footer.html.erb +6 -4
  210. data/app/views/layouts/decidim/_timeout_modal.html.erb +21 -0
  211. data/config/initializers/active_support.rb +7 -0
  212. data/config/initializers/devise.rb +1 -1
  213. data/config/initializers/omniauth.rb +1 -1
  214. data/config/locales/ar.yml +1 -9
  215. data/config/locales/bg.yml +1 -15
  216. data/config/locales/ca.yml +42 -15
  217. data/config/locales/cs.yml +79 -14
  218. data/config/locales/de.yml +78 -13
  219. data/config/locales/el.yml +1 -16
  220. data/config/locales/en.yml +79 -14
  221. data/config/locales/eo.yml +0 -1
  222. data/config/locales/es-MX.yml +30 -15
  223. data/config/locales/es-PY.yml +30 -15
  224. data/config/locales/es.yml +30 -15
  225. data/config/locales/eu.yml +1 -9
  226. data/config/locales/fi-plain.yml +76 -12
  227. data/config/locales/fi.yml +76 -12
  228. data/config/locales/fr-CA.yml +79 -14
  229. data/config/locales/fr.yml +76 -11
  230. data/config/locales/gl.yml +1 -15
  231. data/config/locales/hu.yml +1 -14
  232. data/config/locales/id-ID.yml +1 -9
  233. data/config/locales/is-IS.yml +0 -2
  234. data/config/locales/it.yml +65 -14
  235. data/config/locales/ja.yml +1 -16
  236. data/config/locales/lv.yml +1 -14
  237. data/config/locales/nl.yml +38 -15
  238. data/config/locales/no.yml +7 -16
  239. data/config/locales/pl.yml +98 -23
  240. data/config/locales/pt-BR.yml +1 -9
  241. data/config/locales/pt.yml +1 -16
  242. data/config/locales/ro-RO.yml +20 -16
  243. data/config/locales/ru.yml +1 -10
  244. data/config/locales/sk.yml +1 -14
  245. data/config/locales/sr-CS.yml +0 -9
  246. data/config/locales/sv.yml +5 -16
  247. data/config/locales/tr-TR.yml +62 -13
  248. data/config/locales/uk.yml +1 -7
  249. data/config/locales/zh-CN.yml +1 -16
  250. data/config/routes.rb +9 -4
  251. data/db/migrate/20170713131206_add_admin_to_users.rb +1 -1
  252. data/db/migrate/20180206143340_fix_reference_for_all_resources.rb +2 -0
  253. data/db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb +2 -2
  254. data/db/migrate/20200929171508_remove_show_statistics_from_organizations.rb +7 -0
  255. data/db/migrate/20201010124755_create_decidim_user_moderations.rb +12 -0
  256. data/db/migrate/20201010124756_create_decidim_user_reports.rb +16 -0
  257. data/db/migrate/20201010224433_add_suspension_fields_to_decidim_users.rb +8 -0
  258. data/db/migrate/20201011074641_create_decidim_user_suspensions.rb +14 -0
  259. data/db/migrate/20201011081626_add_current_suspension_id_to_decidim_users.rb +7 -0
  260. data/db/migrate/20201013071533_add_reported_content_to_moderations.rb +7 -0
  261. data/db/migrate/20201019074554_add_locale_to_moderation_reports.rb +7 -0
  262. data/db/migrate/20201127114444_encrypt_authorization_metadatas.rb +35 -0
  263. data/db/migrate/20201128130723_add_allow_public_access_to_static_pages.rb +17 -0
  264. data/db/migrate/20201218144706_update_table_block_user_functionality.rb +8 -0
  265. data/db/migrate/20201218145252_rename_decidim_user_fields_for_block_functionality.rb +9 -0
  266. data/db/migrate/20210208134328_add_email_on_moderations_to_users.rb +7 -0
  267. data/db/seeds.rb +14 -13
  268. data/lib/decidim/amendable.rb +3 -2
  269. data/{app/functions/decidim/core → lib/decidim/api/functions}/component_finder_base.rb +1 -1
  270. data/{app/functions/decidim/core → lib/decidim/api/functions}/component_list.rb +4 -4
  271. data/{app/functions/decidim/core → lib/decidim/api/functions}/component_list_base.rb +3 -1
  272. data/lib/decidim/api/functions/needs_api_default_order.rb +24 -0
  273. data/{app/functions/decidim/core → lib/decidim/api/functions}/needs_api_filter_and_order.rb +0 -0
  274. data/{app/functions/decidim/core → lib/decidim/api/functions}/participatory_space_finder_base.rb +2 -2
  275. data/{app/functions/decidim/core → lib/decidim/api/functions}/participatory_space_list_base.rb +3 -1
  276. data/{app/functions/decidim/core → lib/decidim/api/functions}/user_entity_finder.rb +1 -4
  277. data/{app/functions/decidim/core → lib/decidim/api/functions}/user_entity_list.rb +1 -3
  278. data/{app/types/decidim/core → lib/decidim/api/input_filters}/base_input_filter.rb +0 -0
  279. data/{app/types/decidim/core → lib/decidim/api/input_filters}/component_input_filter.rb +20 -22
  280. data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_hastaggable_input_filter.rb +1 -1
  281. data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_localized_input_filter.rb +3 -3
  282. data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_publishable_input_filter.rb +6 -6
  283. data/{app/types/decidim/core → lib/decidim/api/input_filters}/has_timestamp_input_filter.rb +12 -12
  284. data/{app/types/decidim/core → lib/decidim/api/input_filters}/participatory_space_input_filter.rb +0 -1
  285. data/lib/decidim/api/input_filters/user_entity_input_filter.rb +89 -0
  286. data/{app/types/decidim/core → lib/decidim/api/input_sorts}/base_input_sort.rb +3 -2
  287. data/{app/types/decidim/core → lib/decidim/api/input_sorts}/component_input_sort.rb +10 -11
  288. data/{app/types/decidim/core → lib/decidim/api/input_sorts}/has_endorsable_input_sort.rb +2 -4
  289. data/{app/types/decidim/core → lib/decidim/api/input_sorts}/has_localized_input_sort.rb +3 -3
  290. data/{app/types/decidim/core → lib/decidim/api/input_sorts}/has_publishable_input_sort.rb +1 -1
  291. data/lib/decidim/api/input_sorts/has_timestamp_input_sort.rb +12 -0
  292. data/{app/types/decidim/core → lib/decidim/api/input_sorts}/participatory_space_input_sort.rb +1 -1
  293. data/{app/types/decidim/core → lib/decidim/api/input_sorts}/user_entity_input_sort.rb +4 -4
  294. data/lib/decidim/api/{amendable_entity_interface.rb → interfaces/amendable_entity_interface.rb} +5 -5
  295. data/lib/decidim/api/interfaces/amendable_interface.rb +17 -0
  296. data/lib/decidim/api/{attachable_interface.rb → interfaces/attachable_interface.rb} +3 -3
  297. data/lib/decidim/api/interfaces/author_interface.rb +32 -0
  298. data/lib/decidim/api/interfaces/authorable_interface.rb +23 -0
  299. data/lib/decidim/api/{categorizable_interface.rb → interfaces/categorizable_interface.rb} +3 -3
  300. data/lib/decidim/api/interfaces/coauthorable_interface.rb +30 -0
  301. data/lib/decidim/api/interfaces/component_interface.rb +22 -0
  302. data/lib/decidim/api/interfaces/endorsable_interface.rb +19 -0
  303. data/lib/decidim/api/{fingerprint_interface.rb → interfaces/fingerprint_interface.rb} +3 -3
  304. data/lib/decidim/api/interfaces/participatory_space_interface.rb +48 -0
  305. data/lib/decidim/api/interfaces/participatory_space_resourceable_interface.rb +25 -0
  306. data/lib/decidim/api/{scopable_interface.rb → interfaces/scopable_interface.rb} +3 -3
  307. data/lib/decidim/api/interfaces/timestamps_interface.rb +15 -0
  308. data/lib/decidim/api/interfaces/traceable_interface.rb +14 -0
  309. data/lib/decidim/api/scalars/date_time_type.rb +17 -0
  310. data/lib/decidim/api/scalars/date_type.rb +17 -0
  311. data/lib/decidim/api/types/amendment_type.rb +19 -0
  312. data/lib/decidim/api/types/area_api_type.rb +16 -0
  313. data/lib/decidim/api/types/area_type_type.rb +13 -0
  314. data/lib/decidim/api/types/attachment_type.rb +13 -0
  315. data/lib/decidim/api/types/category_type.rb +14 -0
  316. data/{app/types/decidim/core → lib/decidim/api/types}/component_type.rb +2 -4
  317. data/lib/decidim/api/types/coordinates_type.rb +21 -0
  318. data/lib/decidim/api/types/decidim_type.rb +13 -0
  319. data/lib/decidim/api/types/fingerprint_type.rb +12 -0
  320. data/lib/decidim/api/types/hashtag_type.rb +13 -0
  321. data/lib/decidim/api/types/localized_string_type.rb +13 -0
  322. data/lib/decidim/api/types/metric_history_type.rb +18 -0
  323. data/lib/decidim/api/types/metric_type.rb +13 -0
  324. data/lib/decidim/api/types/organization_type.rb +17 -0
  325. data/lib/decidim/api/types/participatory_space_link_type.rb +22 -0
  326. data/lib/decidim/api/types/participatory_space_type.rb +10 -0
  327. data/lib/decidim/api/types/scope_api_type.rb +16 -0
  328. data/lib/decidim/api/types/session_type.rb +22 -0
  329. data/lib/decidim/api/types/statistic_type.rb +20 -0
  330. data/lib/decidim/api/types/trace_version_type.rb +21 -0
  331. data/lib/decidim/api/types/translated_field_type.rb +36 -0
  332. data/lib/decidim/api/types/user_group_type.rb +64 -0
  333. data/lib/decidim/api/types/user_type.rb +67 -0
  334. data/lib/decidim/attachment_attributes.rb +57 -0
  335. data/lib/decidim/attributes.rb +1 -0
  336. data/lib/decidim/attributes/clean_string.rb +37 -0
  337. data/lib/decidim/coauthorable.rb +3 -3
  338. data/lib/decidim/component_manifest.rb +17 -0
  339. data/lib/decidim/content_block_manifest.rb +1 -1
  340. data/lib/decidim/content_parsers/hashtag_parser.rb +3 -6
  341. data/lib/decidim/content_parsers/user_group_parser.rb +2 -5
  342. data/lib/decidim/content_parsers/user_parser.rb +2 -5
  343. data/lib/decidim/content_processor.rb +1 -1
  344. data/lib/decidim/content_renderers/hashtag_renderer.rb +3 -6
  345. data/lib/decidim/core.rb +11 -3
  346. data/lib/decidim/core/api.rb +71 -16
  347. data/lib/decidim/core/engine.rb +35 -6
  348. data/lib/decidim/core/test.rb +2 -0
  349. data/lib/decidim/core/test/factories.rb +53 -15
  350. data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +1 -1
  351. data/lib/decidim/core/test/shared_examples/amendable/amendment_accepted_event_examples.rb +1 -1
  352. data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +1 -1
  353. data/lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb +1 -1
  354. data/lib/decidim/core/test/shared_examples/comments_examples.rb +11 -9
  355. data/lib/decidim/core/test/shared_examples/component_type.rb +1 -1
  356. data/lib/decidim/core/test/shared_examples/controller_render_views.rb +28 -0
  357. data/lib/decidim/core/test/shared_examples/follows_examples.rb +1 -1
  358. data/lib/decidim/core/test/shared_examples/logo_email.rb +1 -1
  359. data/lib/decidim/core/test/shared_examples/map_examples.rb +1 -1
  360. data/lib/decidim/core/test/shared_examples/process_announcements_examples.rb +1 -1
  361. data/lib/decidim/core/test/shared_examples/reportable.rb +8 -0
  362. data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +1 -1
  363. data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +2 -3
  364. data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +46 -0
  365. data/lib/decidim/core/test/shared_examples/static_pages_examples.rb +43 -0
  366. data/lib/decidim/core/version.rb +1 -1
  367. data/lib/decidim/diffy_extension.rb +2 -2
  368. data/lib/decidim/exporters/csv.rb +3 -2
  369. data/lib/decidim/exporters/export_data.rb +1 -1
  370. data/lib/decidim/faker/internet.rb +17 -0
  371. data/lib/decidim/faker/localized.rb +43 -20
  372. data/lib/decidim/file_validator_humanizer.rb +6 -4
  373. data/lib/decidim/form_builder.rb +33 -22
  374. data/lib/decidim/gamification/badge_scorer.rb +3 -2
  375. data/lib/decidim/gamification/base_event.rb +2 -2
  376. data/lib/decidim/geocodable.rb +2 -0
  377. data/lib/decidim/has_category.rb +1 -1
  378. data/lib/decidim/has_private_users.rb +1 -1
  379. data/lib/decidim/importers/import_manifest.rb +36 -0
  380. data/lib/decidim/map/autocomplete.rb +11 -1
  381. data/lib/decidim/metric_operation.rb +5 -6
  382. data/lib/decidim/participatory_space_resourceable.rb +1 -3
  383. data/lib/decidim/query_extensions.rb +90 -69
  384. data/lib/decidim/randomable.rb +6 -1
  385. data/lib/decidim/record_encryptor.rb +131 -0
  386. data/lib/decidim/reportable.rb +26 -0
  387. data/lib/decidim/resource_manifest.rb +3 -0
  388. data/lib/decidim/resourceable.rb +6 -6
  389. data/lib/decidim/scopable.rb +1 -1
  390. data/lib/decidim/search_resource_fields_mapper.rb +1 -1
  391. data/lib/decidim/searchable.rb +9 -0
  392. data/lib/decidim/settings_manifest.rb +2 -1
  393. data/lib/decidim/shareable_with_token.rb +0 -1
  394. data/lib/decidim/translatable_attributes.rb +2 -1
  395. data/lib/decidim/translatable_resource.rb +10 -0
  396. data/lib/decidim/user_reportable.rb +33 -0
  397. data/lib/decidim/view_model.rb +26 -0
  398. data/lib/premailer/adapter/decidim.rb +4 -4
  399. data/lib/tasks/decidim_data_portability_tasks.rake +4 -4
  400. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ko.js +18 -0
  401. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.vi.js +14 -0
  402. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.zh-CN.js +14 -0
  403. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.zh-TW.js +14 -0
  404. metadata +192 -101
  405. data/app/functions/decidim/core/participatory_space_finder.rb +0 -11
  406. data/app/functions/decidim/core/participatory_space_list.rb +0 -11
  407. data/app/types/decidim/core/amendment_type.rb +0 -26
  408. data/app/types/decidim/core/area_api_type.rb +0 -16
  409. data/app/types/decidim/core/area_type_type.rb +0 -14
  410. data/app/types/decidim/core/attachment_type.rb +0 -14
  411. data/app/types/decidim/core/category_type.rb +0 -16
  412. data/app/types/decidim/core/coordinates_type.rb +0 -19
  413. data/app/types/decidim/core/date_time_type.rb +0 -12
  414. data/app/types/decidim/core/date_type.rb +0 -13
  415. data/app/types/decidim/core/decidim_type.rb +0 -19
  416. data/app/types/decidim/core/fingerprint_type.rb +0 -15
  417. data/app/types/decidim/core/has_timestamp_input_sort.rb +0 -12
  418. data/app/types/decidim/core/hashtag_type.rb +0 -13
  419. data/app/types/decidim/core/localized_string_type.rb +0 -14
  420. data/app/types/decidim/core/metric_history_type.rb +0 -17
  421. data/app/types/decidim/core/metric_type.rb +0 -14
  422. data/app/types/decidim/core/organization_type.rb +0 -20
  423. data/app/types/decidim/core/participatory_space_link_type.rb +0 -24
  424. data/app/types/decidim/core/participatory_space_type.rb +0 -12
  425. data/app/types/decidim/core/scope_api_type.rb +0 -16
  426. data/app/types/decidim/core/session_type.rb +0 -19
  427. data/app/types/decidim/core/statistic_type.rb +0 -22
  428. data/app/types/decidim/core/trace_version_type.rb +0 -29
  429. data/app/types/decidim/core/translated_field_type.rb +0 -45
  430. data/app/types/decidim/core/user_entity_input_filter.rb +0 -81
  431. data/app/types/decidim/core/user_group_type.rb +0 -51
  432. data/app/types/decidim/core/user_type.rb +0 -52
  433. data/app/views/decidim/shared/_announcement.html.erb +0 -1
  434. data/app/views/decidim/shared/_flag_modal.html.erb +0 -20
  435. data/lib/decidim/api/amendable_interface.rb +0 -18
  436. data/lib/decidim/api/author_interface.rb +0 -29
  437. data/lib/decidim/api/authorable_interface.rb +0 -22
  438. data/lib/decidim/api/coauthorable_interface.rb +0 -29
  439. data/lib/decidim/api/component_interface.rb +0 -20
  440. data/lib/decidim/api/endorsable_interface.rb +0 -22
  441. data/lib/decidim/api/participatory_space_interface.rb +0 -47
  442. data/lib/decidim/api/participatory_space_resourceable_interface.rb +0 -21
  443. data/lib/decidim/api/timestamps_interface.rb +0 -21
  444. data/lib/decidim/api/traceable_interface.rb +0 -14
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/concern"
4
+
5
+ module Decidim
6
+ # A set of convenience methods to deal with attachment attributes for Virtus
7
+ # models that may set the attachment records through the original model
8
+ # (Decidim::Attachment) or through the user submitted form data (String).
9
+ module AttachmentAttributes
10
+ extend ActiveSupport::Concern
11
+
12
+ class_methods do
13
+ # Public: Mirrors Virtus' `attribute` interface to define attachment
14
+ # attributes for form objects.
15
+ #
16
+ # name - The attribute's name
17
+ #
18
+ #
19
+ # Example:
20
+ #
21
+ # attachment_attribute :photos
22
+ # # This will create two attributes of the following types:
23
+ # # attribute :photos, Array[String]
24
+ # # attribute :add_photos, Array
25
+ # # In addition, it will generate the getter method for the attribute
26
+ # # returning an array of the Decidim::Attachment records.
27
+ #
28
+ # Returns nothing.
29
+ def attachments_attribute(name)
30
+ attribute name, Array[String]
31
+ attribute "add_#{name}".to_sym, Array
32
+
33
+ # Define the getter method that fetches the attachment records based on
34
+ # their types. For Strings and Integers, assumes they are IDs and will
35
+ # fetch the attachment record matching that ID.
36
+ variable_name = "@#{name}_records"
37
+ define_method name do
38
+ return instance_variable_get(variable_name) if instance_variable_defined?(variable_name)
39
+
40
+ original = instance_variable_get("@#{name}")
41
+ return original unless original.is_a?(Array)
42
+
43
+ instance_variable_set(
44
+ variable_name,
45
+ original.map do |attachment|
46
+ if attachment.is_a?(String) || attachment.is_a?(Integer)
47
+ Decidim::Attachment.find_by(id: attachment)
48
+ else
49
+ attachment
50
+ end
51
+ end.compact
52
+ )
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -4,5 +4,6 @@ module Decidim
4
4
  module Attributes
5
5
  autoload :TimeWithZone, "decidim/attributes/time_with_zone"
6
6
  autoload :LocalizedDate, "decidim/attributes/localized_date"
7
+ autoload :CleanString, "decidim/attributes/clean_string"
7
8
  end
8
9
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Attributes
5
+ # Custom Virtus value to "standardize" the newline characters within strings
6
+ # that are sent through user entered forms. This strips out the carriage
7
+ # return characters from the strings in order to avoid validation mismatches
8
+ # with the string lengths between the frontend and the backend.
9
+ #
10
+ # This type should be used with forms that have:
11
+ # - A user input defined with the <textarea> element
12
+ # - The input element having the `maxlength` attribute defined for it
13
+ # - The backend having a maximum length validation for the input
14
+ class CleanString < Virtus::Attribute
15
+ # When using Windows or copying texts from existing documents, the text
16
+ # can contain the carriage return characters (\r) that the front-end
17
+ # character counter does not consider as actual characters. This happens
18
+ # because the character counter currently counts the characters using
19
+ # jQuery's `$input.val()` method which strips out the carriage return
20
+ # characters as explained at:
21
+ # https://api.jquery.com/val/
22
+ #
23
+ # Note: At present, using .val() on <textarea> elements strips carriage
24
+ # return characters from the browser-reported value.
25
+ #
26
+ # The backend, on the other hand, calculates these as characters as they
27
+ # are included in the data that gets sent to the server. In order to fix
28
+ # this mismatch, remove the carriage return characters from the text
29
+ # using this attribute type.
30
+ def coerce(value)
31
+ return value unless value.is_a?(String)
32
+
33
+ value.gsub(/\r/, "")
34
+ end
35
+ end
36
+ end
37
+ end
@@ -91,7 +91,7 @@ module Decidim
91
91
  #
92
92
  # author - the author to check for authorship
93
93
  def authored_by?(author)
94
- coauthorships.where(author: author).exists?
94
+ coauthorships.exists?(author: author)
95
95
  end
96
96
 
97
97
  # Returns the identities for the authors, whether they are user groups, users or others.
@@ -140,8 +140,8 @@ module Decidim
140
140
  def add_coauthor(author, extra_attributes = {})
141
141
  user_group = extra_attributes[:user_group]
142
142
 
143
- return if coauthorships.where(decidim_author_id: author.id, decidim_author_type: author.class.base_class.name).exists? && user_group.blank?
144
- return if user_group && coauthorships.where(user_group: user_group).exists?
143
+ return if coauthorships.exists?(decidim_author_id: author.id, decidim_author_type: author.class.base_class.name) && user_group.blank?
144
+ return if user_group && coauthorships.exists?(user_group: user_group)
145
145
 
146
146
  coauthorship_attributes = extra_attributes.merge(author: author)
147
147
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "decidim/settings_manifest"
4
4
  require "decidim/exporters/export_manifest"
5
+ require "decidim/importers/import_manifest"
5
6
 
6
7
  module Decidim
7
8
  # This class handles all the logic associated to configuring a component
@@ -189,6 +190,22 @@ module Decidim
189
190
  end
190
191
  end
191
192
 
193
+ def imports(name, &block)
194
+ return unless name
195
+
196
+ @imports ||= []
197
+ @imports << [name, block]
198
+ @import_manifests = nil
199
+ end
200
+
201
+ def import_manifests
202
+ @import_manifests ||= Array(@imports).map do |(name, block)|
203
+ Decidim::Importers::ImportManifest.new(name, self).tap do |manifest|
204
+ block.call(manifest)
205
+ end
206
+ end
207
+ end
208
+
192
209
  def serializes_specific_data?
193
210
  serializes_specific_data
194
211
  end
@@ -53,7 +53,7 @@ module Decidim
53
53
  private
54
54
 
55
55
  def image_names_are_unique
56
- image_names = images.map { |image| image[:name] }
56
+ image_names = images.pluck(:name)
57
57
  errors.add(:images, "names must be unique per manifest") if image_names.count != image_names.uniq.count
58
58
  end
59
59
 
@@ -25,7 +25,7 @@ module Decidim
25
25
  # @return [String] the content with the hashtags replaced by global ids
26
26
  def rewrite
27
27
  content.gsub(HASHTAG_REGEX) do |match|
28
- hashtag(match[1..-1]).to_global_id.to_s + "/" + (extra_hashtags? ? "_" : "") + match[1..-1]
28
+ "#{hashtag(match[1..-1]).to_global_id}/#{(extra_hashtags? ? "_" : "")}#{match[1..-1]}"
29
29
  end
30
30
  end
31
31
 
@@ -40,11 +40,8 @@ module Decidim
40
40
  end
41
41
 
42
42
  def hashtags
43
- @hashtags ||= Hash[
44
- existing_hashtags.map do |hashtag|
45
- [hashtag.name, hashtag]
46
- end
47
- ]
43
+ @hashtags ||=
44
+ existing_hashtags.index_by(&:name)
48
45
  end
49
46
 
50
47
  def existing_hashtags
@@ -38,11 +38,8 @@ module Decidim
38
38
  private
39
39
 
40
40
  def groups
41
- @groups ||= Hash[
42
- existing_groups.map do |group|
43
- [group.nickname, group]
44
- end
45
- ]
41
+ @groups ||=
42
+ existing_groups.index_by(&:nickname)
46
43
  end
47
44
 
48
45
  def existing_groups
@@ -38,11 +38,8 @@ module Decidim
38
38
  private
39
39
 
40
40
  def users
41
- @users ||= Hash[
42
- existing_users.map do |user|
43
- [user.nickname, user]
44
- end
45
- ]
41
+ @users ||=
42
+ existing_users.index_by(&:nickname)
46
43
  end
47
44
 
48
45
  def existing_users
@@ -116,7 +116,7 @@ module Decidim
116
116
  return content if content.blank?
117
117
 
118
118
  Decidim.content_processors.reduce(content) do |result, type|
119
- renderer_klass(type).constantize.new(result).render(options)
119
+ renderer_klass(type).constantize.new(result).render(**options)
120
120
  end
121
121
  end
122
122
 
@@ -10,7 +10,7 @@ module Decidim
10
10
  # @see BaseRenderer Examples of how to use a content renderer
11
11
  class HashtagRenderer < BaseRenderer
12
12
  # Matches a global id representing a Decidim::Hashtag
13
- GLOBAL_ID_REGEX = %r{gid:\/\/[\w-]*\/Decidim::Hashtag\/(\d+)\/?(_?)([[:alnum:]](?:[[:alnum:]]|_)*)?\b}.freeze
13
+ GLOBAL_ID_REGEX = %r{gid://[\w-]*/Decidim::Hashtag/(\d+)/?(_?)([[:alnum:]](?:[[:alnum:]]|_)*)?\b}.freeze
14
14
 
15
15
  # Replaces found Global IDs matching an existing hashtag with
16
16
  # a link to their detail page. The Global IDs representing an
@@ -47,11 +47,8 @@ module Decidim
47
47
  private
48
48
 
49
49
  def hashtags
50
- @hashtags ||= Hash[
51
- existing_hashtags.map do |hashtag|
52
- [hashtag.id, hashtag]
53
- end
54
- ]
50
+ @hashtags ||=
51
+ existing_hashtags.index_by(&:id)
55
52
  end
56
53
 
57
54
  def existing_hashtags
data/lib/decidim/core.rb CHANGED
@@ -20,6 +20,7 @@ module Decidim
20
20
  autoload :Traceable, "decidim/traceable"
21
21
  autoload :Loggable, "decidim/loggable"
22
22
  autoload :Reportable, "decidim/reportable"
23
+ autoload :UserReportable, "decidim/user_reportable"
23
24
  autoload :Authorable, "decidim/authorable"
24
25
  autoload :Coauthorable, "decidim/coauthorable"
25
26
  autoload :Participable, "decidim/participable"
@@ -92,6 +93,8 @@ module Decidim
92
93
  autoload :HasUploadValidations, "decidim/has_upload_validations"
93
94
  autoload :FileValidatorHumanizer, "decidim/file_validator_humanizer"
94
95
  autoload :ShareableWithToken, "decidim/shareable_with_token"
96
+ autoload :RecordEncryptor, "decidim/record_encryptor"
97
+ autoload :AttachmentAttributes, "decidim/attachment_attributes"
95
98
 
96
99
  include ActiveSupport::Configurable
97
100
  # Loads seeds from all engines.
@@ -115,7 +118,7 @@ module Decidim
115
118
  organization,
116
119
  manifest.name,
117
120
  Decidim::Faker::Localized.wrapped("<p>", "</p>") do
118
- Decidim::Faker::Localized.sentence(15)
121
+ Decidim::Faker::Localized.sentence(word_count: 15)
119
122
  end
120
123
  )
121
124
  end
@@ -149,7 +152,7 @@ module Decidim
149
152
 
150
153
  # Exposes a configuration option: The application available locales.
151
154
  config_accessor :available_locales do
152
- %w(en bg ar ca cs da de el eo es es-MX es-PY et eu fi-pl fi fr fr-CA ga gl hr hu id is it ja lt lv mt nl no pl pt pt-BR ro ru sk sl sr sv tr uk)
155
+ %w(en bg ar ca cs da de el eo es es-MX es-PY et eu fi-pl fi fr fr-CA ga gl hr hu id is it ja ko lt lv mt nl no pl pt pt-BR ro ru sk sl sr sv tr uk vi zh-CN zh-TW)
153
156
  end
154
157
 
155
158
  # Exposes a configuration option: The application default locale.
@@ -357,6 +360,11 @@ module Decidim
357
360
  "decidim-cc"
358
361
  end
359
362
 
363
+ # Defines how often session_timeouter.js checks time between current moment and last request
364
+ config_accessor :session_timeouter_interval do
365
+ 10_000
366
+ end
367
+
360
368
  # Public: Registers a global engine. This method is intended to be used
361
369
  # by component engines that also offer unscoped functionality
362
370
  #
@@ -556,7 +564,7 @@ module Decidim
556
564
  organization = begin
557
565
  if model.is_a?(Decidim::Organization)
558
566
  model
559
- elsif model.respond_to?(:organization)
567
+ elsif model.respond_to?(:organization) && model.organization.present?
560
568
  model.organization
561
569
  end
562
570
  end
@@ -2,21 +2,76 @@
2
2
 
3
3
  module Decidim
4
4
  module Core
5
- autoload :ParticipatorySpaceInterface, "decidim/api/participatory_space_interface"
6
- autoload :ComponentInterface, "decidim/api/component_interface"
7
- autoload :AuthorInterface, "decidim/api/author_interface"
8
- autoload :AuthorableInterface, "decidim/api/authorable_interface"
9
- autoload :CoauthorableInterface, "decidim/api/coauthorable_interface"
10
- autoload :CategorizableInterface, "decidim/api/categorizable_interface"
11
- autoload :ScopableInterface, "decidim/api/scopable_interface"
12
- autoload :AttachableInterface, "decidim/api/attachable_interface"
13
- autoload :HashtagInterface, "decidim/api/hashtag_interface"
14
- autoload :ParticipatorySpaceResourceableInterface, "decidim/api/participatory_space_resourceable_interface"
15
- autoload :FingerprintInterface, "decidim/api/fingerprint_interface"
16
- autoload :AmendableInterface, "decidim/api/amendable_interface"
17
- autoload :AmendableEntityInterface, "decidim/api/amendable_entity_interface"
18
- autoload :TraceableInterface, "decidim/api/traceable_interface"
19
- autoload :TimestampsInterface, "decidim/api/timestamps_interface"
20
- autoload :EndorsableInterface, "decidim/api/endorsable_interface"
5
+ autoload :ComponentFinderBase, "decidim/api/functions/component_finder_base"
6
+ autoload :ComponentList, "decidim/api/functions/component_list"
7
+ autoload :ComponentListBase, "decidim/api/functions/component_list_base"
8
+ autoload :NeedsApiFilterAndOrder, "decidim/api/functions/needs_api_filter_and_order"
9
+ autoload :NeedsApiDefaultOrder, "decidim/api/functions/needs_api_default_order"
10
+ autoload :ParticipatorySpaceFinderBase, "decidim/api/functions/participatory_space_finder_base"
11
+ autoload :ParticipatorySpaceListBase, "decidim/api/functions/participatory_space_list_base"
12
+ autoload :UserEntityFinder, "decidim/api/functions/user_entity_finder"
13
+ autoload :UserEntityList, "decidim/api/functions/user_entity_list"
14
+
15
+ autoload :AmendmentType, "decidim/api/types/amendment_type"
16
+ autoload :AreaApiType, "decidim/api/types/area_api_type"
17
+ autoload :AreaTypeType, "decidim/api/types/area_type_type"
18
+ autoload :AttachmentType, "decidim/api/types/attachment_type"
19
+ autoload :CategoryType, "decidim/api/types/category_type"
20
+ autoload :ComponentType, "decidim/api/types/component_type"
21
+ autoload :CoordinatesType, "decidim/api/types/coordinates_type"
22
+ autoload :DecidimType, "decidim/api/types/decidim_type"
23
+ autoload :FingerprintType, "decidim/api/types/fingerprint_type"
24
+ autoload :HashtagType, "decidim/api/types/hashtag_type"
25
+ autoload :LocalizedStringType, "decidim/api/types/localized_string_type"
26
+ autoload :MetricHistoryType, "decidim/api/types/metric_history_type"
27
+ autoload :MetricType, "decidim/api/types/metric_type"
28
+ autoload :OrganizationType, "decidim/api/types/organization_type"
29
+ autoload :ParticipatorySpaceType, "decidim/api/types/participatory_space_type"
30
+ autoload :ParticipatorySpaceLinkType, "decidim/api/types/participatory_space_link_type"
31
+ autoload :ScopeApiType, "decidim/api/types/scope_api_type"
32
+ autoload :SessionType, "decidim/api/types/session_type"
33
+ autoload :StatisticType, "decidim/api/types/statistic_type"
34
+ autoload :TraceVersionType, "decidim/api/types/trace_version_type"
35
+ autoload :TranslatedFieldType, "decidim/api/types/translated_field_type"
36
+ autoload :UserGroupType, "decidim/api/types/user_group_type"
37
+ autoload :UserType, "decidim/api/types/user_type"
38
+
39
+ autoload :BaseInputFilter, "decidim/api/input_filters/base_input_filter"
40
+ autoload :ComponentInputFilter, "decidim/api/input_filters/component_input_filter"
41
+ autoload :HasHastaggableInputFilter, "decidim/api/input_filters/has_hastaggable_input_filter"
42
+ autoload :HasLocalizedInputFilter, "decidim/api/input_filters/has_localized_input_filter"
43
+ autoload :HasPublishableInputFilter, "decidim/api/input_filters/has_publishable_input_filter"
44
+ autoload :HasTimestampInputFilter, "decidim/api/input_filters/has_timestamp_input_filter"
45
+ autoload :ParticipatorySpaceInputFilter, "decidim/api/input_filters/participatory_space_input_filter"
46
+ autoload :UserEntityInputFilter, "decidim/api/input_filters/user_entity_input_filter"
47
+
48
+ autoload :BaseInputSort, "decidim/api/input_sorts/base_input_sort"
49
+ autoload :ComponentInputSort, "decidim/api/input_sorts/component_input_sort"
50
+ autoload :HasEndorsableInputSort, "decidim/api/input_sorts/has_endorsable_input_sort"
51
+ autoload :HasLocalizedInputSort, "decidim/api/input_sorts/has_localized_input_sort"
52
+ autoload :HasPublishableInputSort, "decidim/api/input_sorts/has_publishable_input_sort"
53
+ autoload :HasTimestampInputSort, "decidim/api/input_sorts/has_timestamp_input_sort"
54
+ autoload :ParticipatorySpaceInputSort, "decidim/api/input_sorts/participatory_space_input_sort"
55
+ autoload :UserEntityInputSort, "decidim/api/input_sorts/user_entity_input_sort"
56
+
57
+ autoload :ParticipatorySpaceInterface, "decidim/api/interfaces/participatory_space_interface"
58
+ autoload :ComponentInterface, "decidim/api/interfaces/component_interface"
59
+ autoload :AuthorInterface, "decidim/api/interfaces/author_interface"
60
+ autoload :AuthorableInterface, "decidim/api/interfaces/authorable_interface"
61
+ autoload :CoauthorableInterface, "decidim/api/interfaces/coauthorable_interface"
62
+ autoload :CategorizableInterface, "decidim/api/interfaces/categorizable_interface"
63
+ autoload :ScopableInterface, "decidim/api/interfaces/scopable_interface"
64
+ autoload :AttachableInterface, "decidim/api/interfaces/attachable_interface"
65
+ autoload :HashtagInterface, "decidim/api/interfaces/hashtag_interface"
66
+ autoload :ParticipatorySpaceResourceableInterface, "decidim/api/interfaces/participatory_space_resourceable_interface"
67
+ autoload :FingerprintInterface, "decidim/api/interfaces/fingerprint_interface"
68
+ autoload :AmendableInterface, "decidim/api/interfaces/amendable_interface"
69
+ autoload :AmendableEntityInterface, "decidim/api/interfaces/amendable_entity_interface"
70
+ autoload :TraceableInterface, "decidim/api/interfaces/traceable_interface"
71
+ autoload :TimestampsInterface, "decidim/api/interfaces/timestamps_interface"
72
+ autoload :EndorsableInterface, "decidim/api/interfaces/endorsable_interface"
73
+
74
+ autoload :DateTimeType, "decidim/api/scalars/date_time_type"
75
+ autoload :DateType, "decidim/api/scalars/date_type"
21
76
  end
22
77
  end
@@ -37,7 +37,6 @@ require "kaminari"
37
37
  require "doorkeeper"
38
38
  require "doorkeeper-i18n"
39
39
  require "nobspw"
40
- require "kaminari"
41
40
  require "batch-loader"
42
41
  require "etherpad-lite"
43
42
  require "diffy"
@@ -89,9 +88,9 @@ module Decidim
89
88
  end
90
89
 
91
90
  initializer "decidim.graphql_api" do
92
- Decidim::Api::QueryType.define do
93
- Decidim::QueryExtensions.define(self)
94
- end
91
+ # Enable them method `!` everywhere for compatibility, this line will be removed when upgrading to GraphQL 2.0
92
+ GraphQL::DeprecatedDSL.activate
93
+ Decidim::Api::QueryType.include Decidim::QueryExtensions
95
94
 
96
95
  Decidim::Api.add_orphan_type Decidim::Core::UserType
97
96
  Decidim::Api.add_orphan_type Decidim::Core::UserGroupType
@@ -110,7 +109,7 @@ module Decidim
110
109
  # that may be using the `geocoded_by` or `reverse_geocoded_by` class
111
110
  # methods injected by the Geocoder gem.
112
111
  ActiveSupport.on_load :active_record do
113
- ActiveRecord::Base.send(:include, Decidim::Geocodable)
112
+ ActiveRecord::Base.include Decidim::Geocodable
114
113
  end
115
114
  end
116
115
 
@@ -335,6 +334,36 @@ module Decidim
335
334
  end
336
335
  end
337
336
 
337
+ Decidim.metrics_registry.register(:blocked_users) do |metric_registry|
338
+ metric_registry.manager_class = "Decidim::Metrics::BlockedUsersMetricManage"
339
+
340
+ metric_registry.settings do |settings|
341
+ settings.attribute :highlighted, type: :boolean, default: false
342
+ settings.attribute :scopes, type: :array, default: %w(home)
343
+ settings.attribute :weight, type: :integer, default: 1
344
+ end
345
+ end
346
+
347
+ Decidim.metrics_registry.register(:user_reports) do |metric_registry|
348
+ metric_registry.manager_class = "Decidim::Metrics::UserReportsMetricManage"
349
+
350
+ metric_registry.settings do |settings|
351
+ settings.attribute :highlighted, type: :boolean, default: false
352
+ settings.attribute :scopes, type: :array, default: %w(home)
353
+ settings.attribute :weight, type: :integer, default: 1
354
+ end
355
+ end
356
+
357
+ Decidim.metrics_registry.register(:reported_users) do |metric_registry|
358
+ metric_registry.manager_class = "Decidim::Metrics::ReportedUsersMetricManage"
359
+
360
+ metric_registry.settings do |settings|
361
+ settings.attribute :highlighted, type: :boolean, default: false
362
+ settings.attribute :scopes, type: :array, default: %w(home)
363
+ settings.attribute :weight, type: :integer, default: 1
364
+ end
365
+ end
366
+
338
367
  Decidim.metrics_registry.register(:participants) do |metric_registry|
339
368
  metric_registry.manager_class = "Decidim::Metrics::ParticipantsMetricManage"
340
369
 
@@ -513,7 +542,7 @@ module Decidim
513
542
  end
514
543
 
515
544
  config.to_prepare do
516
- FoundationRailsHelper::FlashHelper.send(:include, Decidim::FlashHelperExtensions)
545
+ FoundationRailsHelper::FlashHelper.include Decidim::FlashHelperExtensions
517
546
  end
518
547
  end
519
548
  end