decidim-core 0.30.0.rc2 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/amendable/amendments/show.erb +1 -1
  3. data/app/cells/decidim/participatory_space_dropdown_metadata/show.erb +5 -3
  4. data/app/cells/decidim/profile_actions/show.erb +1 -1
  5. data/app/cells/decidim/report_button/already_reported_modal.erb +2 -2
  6. data/app/cells/decidim/report_button/flag_modal.erb +13 -27
  7. data/app/cells/decidim/report_button_cell.rb +2 -8
  8. data/app/cells/decidim/report_user_button/already_reported_modal.erb +11 -0
  9. data/app/cells/decidim/report_user_button/flag_modal.erb +46 -0
  10. data/app/cells/decidim/report_user_button/show.erb +2 -0
  11. data/app/cells/decidim/report_user_button_cell.rb +59 -0
  12. data/app/cells/decidim/resource_types_filter/show.erb +1 -1
  13. data/app/cells/decidim/resource_types_filter_cell.rb +6 -6
  14. data/app/cells/decidim/user_activity/show.erb +1 -1
  15. data/app/commands/decidim/create_omniauth_registration.rb +14 -8
  16. data/app/commands/decidim/create_report.rb +1 -6
  17. data/app/commands/decidim/search.rb +14 -0
  18. data/app/controllers/decidim/profiles_controller.rb +2 -2
  19. data/app/controllers/decidim/reports_controller.rb +1 -1
  20. data/app/controllers/decidim/user_activities_controller.rb +1 -1
  21. data/app/forms/decidim/account_form.rb +5 -2
  22. data/app/jobs/decidim/hide_child_resources_job.rb +3 -3
  23. data/app/jobs/decidim/migrate/paper_trail_job.rb +33 -0
  24. data/app/mailers/decidim/reported_mailer.rb +1 -0
  25. data/app/models/decidim/action_log.rb +1 -9
  26. data/app/models/decidim/user.rb +0 -4
  27. data/app/models/decidim/user_base_entity.rb +4 -0
  28. data/app/packs/src/decidim/datepicker/datepicker_functions.js +3 -3
  29. data/app/packs/src/decidim/index.js +4 -2
  30. data/app/packs/src/decidim/sticky_footer.js +19 -0
  31. data/app/packs/stylesheets/decidim/_cards.scss +4 -0
  32. data/app/packs/stylesheets/decidim/_content_blocks.scss +5 -1
  33. data/app/packs/stylesheets/decidim/_header.scss +6 -2
  34. data/app/packs/stylesheets/decidim/_login.scss +4 -0
  35. data/app/packs/stylesheets/decidim/_modal_authorization.scss +1 -1
  36. data/app/packs/stylesheets/decidim/_profile.scss +1 -1
  37. data/app/presenters/decidim/log/user_presenter.rb +1 -0
  38. data/app/presenters/decidim/user_presenter.rb +1 -1
  39. data/app/resolvers/decidim/meta_image_url_resolver.rb +1 -0
  40. data/app/services/decidim/base_diff_renderer.rb +2 -0
  41. data/app/services/decidim/static_map_generator.rb +1 -1
  42. data/app/views/decidim/devise/registrations/new.html.erb +1 -1
  43. data/app/views/decidim/devise/sessions/new.html.erb +1 -1
  44. data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +1 -1
  45. data/app/views/decidim/last_activities/index.html.erb +1 -1
  46. data/app/views/decidim/open_data/index.html.erb +1 -1
  47. data/app/views/decidim/reported_mailer/hide.html.erb +17 -1
  48. data/app/views/decidim/reported_mailer/report.html.erb +1 -1
  49. data/app/views/decidim/searches/_count.html.erb +1 -1
  50. data/app/views/decidim/searches/_filters.html.erb +40 -38
  51. data/app/views/layouts/decidim/footer/_main_legal.html.erb +1 -1
  52. data/config/locales/ar.yml +15 -28
  53. data/config/locales/bg.yml +10 -24
  54. data/config/locales/bs-BA.yml +2 -0
  55. data/config/locales/ca-IT.yml +2400 -0
  56. data/config/locales/ca.yml +43 -35
  57. data/config/locales/cs.yml +25 -32
  58. data/config/locales/de.yml +19 -25
  59. data/config/locales/el.yml +10 -15
  60. data/config/locales/en.yml +24 -16
  61. data/config/locales/eo.yml +2 -0
  62. data/config/locales/es-MX.yml +39 -31
  63. data/config/locales/es-PY.yml +44 -36
  64. data/config/locales/es.yml +42 -34
  65. data/config/locales/eu.yml +104 -98
  66. data/config/locales/fi-plain.yml +14 -28
  67. data/config/locales/fi.yml +15 -29
  68. data/config/locales/fr-CA.yml +74 -24
  69. data/config/locales/fr.yml +73 -23
  70. data/config/locales/ga-IE.yml +4 -4
  71. data/config/locales/gl.yml +25 -14
  72. data/config/locales/hu.yml +9 -23
  73. data/config/locales/id-ID.yml +24 -15
  74. data/config/locales/is-IS.yml +10 -0
  75. data/config/locales/it.yml +34 -26
  76. data/config/locales/ja.yml +188 -27
  77. data/config/locales/lb.yml +24 -22
  78. data/config/locales/lt.yml +5 -17
  79. data/config/locales/lv.yml +18 -15
  80. data/config/locales/nl.yml +22 -17
  81. data/config/locales/no.yml +18 -16
  82. data/config/locales/pl.yml +6 -20
  83. data/config/locales/pt-BR.yml +11 -24
  84. data/config/locales/pt.yml +18 -16
  85. data/config/locales/ro-RO.yml +187 -20
  86. data/config/locales/ru.yml +23 -8
  87. data/config/locales/sk.yml +29 -18
  88. data/config/locales/sr-CS.yml +2 -0
  89. data/config/locales/sv.yml +30 -26
  90. data/config/locales/tr-TR.yml +24 -23
  91. data/config/locales/uk.yml +12 -1
  92. data/config/locales/zh-CN.yml +18 -15
  93. data/config/locales/zh-TW.yml +8 -16
  94. data/db/migrate/20240722215500_change_object_changes_on_versions.rb +4 -24
  95. data/lib/decidim/asset_router/storage.rb +7 -2
  96. data/lib/decidim/attributes/time_with_zone.rb +5 -1
  97. data/lib/decidim/content_parsers/blob_parser.rb +10 -8
  98. data/lib/decidim/content_parsers/user_parser.rb +1 -1
  99. data/lib/decidim/core/test/shared_examples/reports_examples.rb +8 -15
  100. data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +26 -0
  101. data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +26 -0
  102. data/lib/decidim/core/version.rb +1 -1
  103. data/lib/decidim/map/provider/static_map/here.rb +34 -0
  104. data/lib/decidim/moderation_tools.rb +14 -8
  105. data/lib/decidim/nicknamizable.rb +1 -1
  106. data/lib/decidim/participatory_space_user.rb +1 -3
  107. data/lib/decidim/reportable.rb +6 -2
  108. data/lib/decidim/translatable_attributes.rb +5 -1
  109. data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +23 -20
  110. metadata +12 -14
  111. data/app/cells/decidim/author/flag.erb +0 -6
  112. data/app/cells/decidim/author/flag_user.erb +0 -14
  113. data/app/cells/decidim/flag_modal/flag_user.erb +0 -34
  114. data/app/cells/decidim/flag_modal/show.erb +0 -52
  115. data/app/cells/decidim/flag_modal_cell.rb +0 -56
  116. data/app/cells/decidim/profile_sidebar/show.erb +0 -167
  117. data/app/cells/decidim/profile_sidebar_cell.rb +0 -68
  118. data/lib/tasks/upgrade/clean_hidden_resources.rake +0 -33
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- class FlagModalCell < Decidim::ViewModel
5
- include ActionView::Helpers::FormOptionsHelper
6
-
7
- def flag_user
8
- render
9
- end
10
-
11
- def cache_hash
12
- hash = []
13
- hash.push(I18n.locale)
14
- hash.push(current_user.try(:id))
15
- hash.push(model.reported_by?(current_user) ? 1 : 0)
16
- hash.push(model.class.name.gsub("::", ":"))
17
- hash.push(model.id)
18
- hash.join(Decidim.cache_key_separator)
19
- end
20
-
21
- private
22
-
23
- def frontend_administrable?
24
- author.respond_to?(:nickname) &&
25
- model.can_be_administered_by?(current_user) &&
26
- (model.respond_to?(:official?) && !model.official?)
27
- end
28
-
29
- def link_to_profile
30
- author.presenter.profile_url
31
- end
32
-
33
- def author
34
- model.try(:creator_identity) || model.try(:normalized_author)
35
- end
36
-
37
- def user_report_form
38
- Decidim::ReportForm.from_params(reason: "spam")
39
- end
40
-
41
- def modal_id
42
- options[:modal_id] || "flagModal"
43
- end
44
-
45
- def hide_checkbox_id
46
- @hide_checkbox_id ||= Digest::MD5.hexdigest("report_form_hide_#{model.class.name}_#{model.id}")
47
- end
48
-
49
- def report_form
50
- @report_form ||= begin
51
- context = { can_hide: model.try(:can_be_administered_by?, current_user) }
52
- Decidim::ReportForm.new(reason: "spam").with_context(context)
53
- end
54
- end
55
- end
56
- end
@@ -1,167 +0,0 @@
1
- <div class="card profile--sidebar">
2
- <%= image_tag profile_user.avatar_url(:profile), class: "card__image card__image--larger", alt: "avatar #{profile_user.name}" %>
3
- <div>
4
- <h1>
5
- <strong><%= profile_user.name %></strong>
6
- <br>
7
- <span>
8
- <%= profile_user.nickname %> <br>
9
- </span>
10
- <% if user_flaggable? %>
11
- <span class="user-report_link">
12
- <%== cell("decidim/author", profile_user, from:profile_user).flag_user %>
13
- </span>
14
- &nbsp;
15
- <% end %>
16
- <% if can_contact_user? %>
17
- <span>
18
- <%= link_to_current_or_new_conversation_with(profile_holder) %>
19
- </span>
20
- <% end %>
21
- </h1>
22
- <div>
23
- <small><%= decidim_html_escape(profile_user.about.to_s) %></small>
24
- </div>
25
- <% if profile_user.personal_url.present? %>
26
- <%= link_to html_truncate(profile_user.personal_url.gsub(%r{https?\:\/\/}, ""), length: 30), profile_user.personal_url, rel: "nofollow noopener noreferrer ugc" %>
27
- <% end %>
28
- </div>
29
- <% if profile_user.badge.present? %>
30
- <div>
31
- <span>
32
- <%= icon profile_user.badge, class: "author__verified", aria_label: t("decidim.profiles.show.officialized"), role: "img" %>
33
- </span>
34
- <span>
35
- <%= officialization_text %>
36
- </span>
37
- </div>
38
- <% end %>
39
- <%= render_hook(:user_profile_bottom) %>
40
- <div>
41
- <div class="text-center">
42
- <% if profile_user_can_follow? %>
43
- <div>
44
- <%= link_to profile_followers_path(nickname: profile_holder.nickname) do %>
45
- <%= t("decidim.profiles.show.followers") %>
46
- <div><strong><%= profile_user.followers_count %></strong></div>
47
- <% end %>
48
- </div>
49
- <div>
50
- <%= link_to profile_following_path(nickname: profile_holder.nickname) do %>
51
- <%= t("decidim.profiles.show.following") %>
52
- <div><strong><%= profile_user.following_count %></strong></div>
53
- <% end %>
54
- </div>
55
- <% else %>
56
- <div>
57
- <%= link_to profile_followers_path(nickname: profile_holder.nickname) do %>
58
- <%= t("decidim.profiles.show.followers") %>
59
- <div><%= profile_user.followers_count %></div>
60
- <% end %>
61
- </div>
62
- <div>
63
- <%= link_to profile_members_path(nickname: profile_holder.nickname) do %>
64
- <%= t("decidim.profiles.show.members") %>
65
- <div><%= profile_user.members_count %></div>
66
- <% end %>
67
- </div>
68
- <% end %>
69
- </div>
70
- </div>
71
-
72
- <% if current_organization.badges_enabled? && badge_statuses.any? %>
73
- <div>
74
- <div>
75
- <div class="row column">
76
- <strong><%= t("decidim.profiles.sidebar.badges.title") %></strong>
77
- <div>
78
- <div data-tooltip data-position="top" title="<%= t("decidim.profiles.sidebar.badges.info") %>" data-yeti-box="badges-tooltip" data-toggle="badges-tooltip" data-resize="badges-tooltip" data-events="resize">
79
- <%= icon "info", class: "icon--small", role: "img", "aria-hidden": true %>
80
- </div>
81
- </div>
82
- </div>
83
- <div class="row collapse">
84
- <% badge_statuses.each do |status| %>
85
- <div class="column">
86
- <div>
87
- <%= cell("decidim/badge", profile_holder, badge: status.badge, status:).call(:small) %>
88
- </div>
89
- </div>
90
- <% end %>
91
- </div>
92
- </div>
93
- </div>
94
- <% end %>
95
- </div>
96
-
97
- <div class="row">
98
- <div class="column">
99
- <% if own_profile? %>
100
- <div class="text-center">
101
- <%= link_to decidim.account_path, class: "button" do %>
102
- <span>
103
- <%= t("decidim.profiles.user.edit_profile") %>
104
- </span>
105
- <% end %>
106
- </div>
107
- <% if user_groups_enabled? %>
108
- <div class="text-center">
109
- <%= link_to decidim.new_group_path, class: "button hollow" do %>
110
- <span>
111
- <%= t("decidim.profiles.user.create_user_group") %>
112
- </span>
113
- <% end %>
114
- </div>
115
- <% end %>
116
- <% elsif logged_in? %>
117
- <%= cell "decidim/follow_button", profile_holder %>
118
- <% end %>
119
-
120
- <% if user_groups_enabled? %>
121
- <% if can_edit_user_group_profile? %>
122
- <% if user_group_email_to_be_confirmed? %>
123
- <div class="text-center">
124
- <%= link_to decidim.group_email_confirmation_path(model.nickname), method: :post, class: "button hollow expanded" do %>
125
- <span>
126
- <%= t("decidim.profiles.user.resend_email_confirmation_instructions") %>
127
- </span>
128
- <% end %>
129
- </div>
130
- <% end %>
131
-
132
- <div class="text-center">
133
- <%= link_to t("decidim.profiles.user.edit_user_group"), edit_group_path(profile_holder.nickname) %>
134
- </div>
135
- <div class="text-center">
136
- <%= link_to t("decidim.profiles.user.manage_user_group_users"), profile_group_members_path(profile_holder.nickname) %>
137
- </div>
138
- <div class="text-center">
139
- <%= link_to t("decidim.profiles.user.manage_user_group_admins"), profile_group_admins_path(profile_holder.nickname) %>
140
- </div>
141
- <div class="text-center">
142
- <%= link_to t("decidim.profiles.user.invite_user"), group_invites_path(profile_holder.nickname) %>
143
- </div>
144
- <% end %>
145
-
146
- <% if can_join_user_group? %>
147
- <div class="text-center">
148
- <%= link_to decidim.group_join_requests_path(model.nickname), method: :post, class: "button hollow expanded" do %>
149
- <span>
150
- <%= t("decidim.profiles.user.join_user_group") %>
151
- </span>
152
- <% end %>
153
- </div>
154
- <% end %>
155
-
156
- <% if can_leave_group? %>
157
- <div class="text-center">
158
- <%= link_to decidim.leave_group_path(model.nickname), method: :delete, data: { confirm: t("decidim.groups.actions.are_you_sure") }, class: "button hollow expanded" do %>
159
- <span>
160
- <%= t("decidim.profiles.user.leave_user_group") %>
161
- </span>
162
- <% end %>
163
- </div>
164
- <% end %>
165
- <% end %>
166
- </div>
167
- </div>
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- class ProfileSidebarCell < Decidim::ProfileCell
5
- include Decidim::Messaging::ConversationHelper
6
- include Decidim::ViewHooksHelper
7
- include Decidim::CellsHelper
8
-
9
- helper_method :profile_user
10
-
11
- def show
12
- render :show
13
- end
14
-
15
- private
16
-
17
- def profile_user
18
- @profile_user ||= present(model)
19
- end
20
-
21
- def can_contact_user?
22
- !current_user || (current_user && current_user != model && profile_user.can_be_contacted?)
23
- end
24
-
25
- def officialization_text
26
- profile_user.officialization_text
27
- end
28
-
29
- def can_edit_user_group_profile?
30
- return false unless current_user
31
- return false if model.is_a?(Decidim::User)
32
-
33
- Decidim::UserGroups::ManageableUserGroups.for(current_user).include?(model)
34
- end
35
-
36
- def profile_user_can_follow?
37
- profile_user.can_follow?
38
- end
39
-
40
- def badge_statuses
41
- Decidim::Gamification.badges.select { |badge| badge.valid_for?(profile_holder) }.map do |badge|
42
- status = Decidim::Gamification.status_for(profile_holder, badge.name)
43
- status.level.positive? ? status : nil
44
- end.compact
45
- end
46
-
47
- def can_join_user_group?
48
- return false unless current_user
49
- return false if model.is_a?(Decidim::User)
50
-
51
- Decidim::UserGroupMembership.where(user: current_user, user_group: model).empty?
52
- end
53
-
54
- def can_leave_group?
55
- return false unless current_user
56
- return false if model.is_a?(Decidim::User)
57
-
58
- Decidim::UserGroupMembership.where(user: current_user, user_group: model).any?
59
- end
60
-
61
- def user_group_email_to_be_confirmed?
62
- return false unless current_user
63
- return false if model.is_a?(Decidim::User)
64
-
65
- !model.confirmed?
66
- end
67
- end
68
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- namespace :decidim do
4
- namespace :upgrade do
5
- namespace :clean do
6
- desc "Removes all related resources from hidden resource"
7
- task hidden_resources: :environment do
8
- logger.info("Removing child resources for hidden parents...")
9
- Decidim::Moderation.hidden.find_each do |moderation_for_hidden_resource|
10
- reportable = moderation_for_hidden_resource.reportable
11
-
12
- current_user = if Decidim.module_installed?(:ai)
13
- reportable.organization.users.find_by!(email: Decidim::Ai::SpamDetection.reporting_user_email)
14
- else
15
- reportable.organization.admins.first
16
- end
17
-
18
- tool = Decidim::ModerationTools.new(reportable, current_user)
19
- tool.hide!
20
- rescue NameError => e
21
- log_error "Could not hide child resources for reportable id #{moderation_for_hidden_resource.id} because: #{e.message}"
22
- end
23
- end
24
-
25
- private
26
-
27
- def log_error(msg)
28
- puts msg
29
- Rails.logger.error(msg)
30
- end
31
- end
32
- end
33
- end