decidim-core 0.27.3 → 0.27.5
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.
- checksums.yaml +4 -4
- data/app/cells/decidim/activities_cell.rb +1 -7
- data/app/cells/decidim/collapsible_list/show.erb +1 -1
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +1 -4
- data/app/cells/decidim/tags_cell.rb +13 -2
- data/app/cells/decidim/upload_modal/modal.erb +4 -1
- data/app/cells/decidim/upload_modal_cell.rb +8 -4
- data/app/cells/decidim/version_cell.rb +1 -1
- data/app/cells/decidim/versions_list_cell.rb +1 -1
- data/app/commands/decidim/create_omniauth_registration.rb +2 -2
- data/app/commands/decidim/endorse_resource.rb +2 -0
- data/app/commands/decidim/search.rb +1 -1
- data/app/commands/decidim/unendorse_resource.rb +1 -1
- data/app/controllers/concerns/decidim/force_authentication.rb +6 -2
- data/app/controllers/decidim/authorization_modals_controller.rb +1 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
- data/app/controllers/decidim/last_activities_controller.rb +1 -7
- data/app/controllers/decidim/links_controller.rb +1 -1
- data/app/controllers/decidim/searches_controller.rb +1 -1
- data/app/controllers/decidim/short_links_controller.rb +1 -1
- data/app/controllers/decidim/user_timeline_controller.rb +1 -1
- data/app/forms/decidim/account_form.rb +1 -1
- data/app/forms/decidim/notifications_settings_form.rb +1 -9
- data/app/forms/decidim/registration_form.rb +1 -1
- data/app/forms/url_validator.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +1 -0
- data/app/helpers/decidim/layout_helper.rb +4 -1
- data/app/helpers/decidim/omniauth_helper.rb +2 -0
- data/app/helpers/decidim/resource_helper.rb +2 -0
- data/app/helpers/decidim/short_link_helper.rb +1 -1
- data/app/jobs/decidim/download_your_data_export_job.rb +2 -1
- data/app/jobs/decidim/open_data_job.rb +2 -0
- data/app/models/decidim/organization.rb +6 -0
- data/app/models/decidim/user.rb +13 -3
- data/app/packs/images/decidim/icons.svg +1 -1
- data/app/packs/images/decidim/vendor/social-share-button/x.svg +6 -0
- data/app/packs/src/decidim/autocomplete.js +11 -2
- data/app/packs/src/decidim/data_picker.js +1 -0
- data/app/packs/src/decidim/direct_uploads/upload_field.js +6 -4
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +10 -8
- data/app/packs/src/decidim/direct_uploads/uploader.js +4 -1
- data/app/packs/src/decidim/geocoding/attach_input.js +4 -1
- data/app/packs/src/decidim/geocoding/provider/here.js +17 -21
- data/app/packs/src/decidim/geocoding/provider/photon.js +1 -1
- data/app/packs/src/decidim/input_character_counter.js +1 -1
- data/app/packs/src/decidim/map/controller/drag_marker.js +0 -2
- data/app/packs/src/decidim/map/controller/markers.js +0 -1
- data/app/packs/src/decidim/map/controller/static.js +0 -1
- data/app/packs/src/decidim/map/controller.js +0 -2
- data/app/packs/src/decidim/map/factory.js +4 -1
- data/app/packs/src/decidim/map/icon.js +0 -1
- data/app/packs/src/decidim/map/legacy.js +0 -1
- data/app/packs/src/decidim/map/provider/default.js +2 -0
- data/app/packs/src/decidim/map/provider/here.js +2 -1
- data/app/packs/src/decidim/utilities/text.js +17 -0
- data/app/packs/stylesheets/decidim/_variables.scss +1 -1
- data/app/packs/stylesheets/decidim/vendor/_social_share_button.scss +4 -0
- data/app/queries/decidim/last_activity.rb +96 -0
- data/app/queries/decidim/metrics/users_metric_manage.rb +6 -6
- data/app/queries/decidim/public_activities.rb +5 -57
- data/app/services/decidim/email_notification_generator.rb +7 -1
- data/app/services/decidim/send_push_notification.rb +1 -1
- data/app/uploaders/decidim/application_uploader.rb +2 -0
- data/app/views/decidim/notifications_settings/show.html.erb +1 -1
- data/app/views/decidim/scopes/_scopes_picker_input.html.erb +1 -1
- data/app/views/decidim/searches/_filters.html.erb +3 -1
- data/app/views/decidim/shared/_share_modal.html.erb +1 -1
- data/app/views/decidim/shared/participatory_space_filters/_filters.html.erb +1 -1
- data/app/views/layouts/decidim/_social_media_links.html.erb +2 -2
- data/config/environment.rb +3 -0
- data/config/locales/ar.yml +11 -17
- data/config/locales/bg.yml +8 -16
- data/config/locales/ca.yml +19 -14
- data/config/locales/cs.yml +31 -11
- data/config/locales/de.yml +113 -46
- data/config/locales/el.yml +157 -13
- data/config/locales/en.yml +6 -1
- data/config/locales/eo.yml +5 -3
- data/config/locales/es-MX.yml +16 -11
- data/config/locales/es-PY.yml +18 -13
- data/config/locales/es.yml +17 -12
- data/config/locales/eu.yml +494 -345
- data/config/locales/fi-plain.yml +29 -3
- data/config/locales/fi.yml +19 -14
- data/config/locales/fr-CA.yml +16 -11
- data/config/locales/fr.yml +17 -12
- data/config/locales/ga-IE.yml +9 -5
- data/config/locales/gl.yml +10 -20
- data/config/locales/hu.yml +46 -18
- data/config/locales/id-ID.yml +12 -19
- data/config/locales/is-IS.yml +7 -3
- data/config/locales/it.yml +14 -10
- data/config/locales/ja.yml +39 -21
- data/config/locales/kaa.yml +10 -0
- data/config/locales/lb.yml +16 -12
- data/config/locales/lt.yml +57 -9
- data/config/locales/lv.yml +8 -16
- data/config/locales/nl.yml +8 -8
- data/config/locales/no.yml +15 -11
- data/config/locales/pl.yml +24 -6
- data/config/locales/pt-BR.yml +164 -7
- data/config/locales/pt.yml +12 -8
- data/config/locales/ro-RO.yml +8 -7
- data/config/locales/ru.yml +6 -17
- data/config/locales/sk.yml +21 -19
- data/config/locales/sl.yml +0 -5
- data/config/locales/sq-AL.yml +1 -0
- data/config/locales/sr-CS.yml +8 -0
- data/config/locales/sv.yml +34 -16
- data/config/locales/th-TH.yml +1 -0
- data/config/locales/tr-TR.yml +21 -12
- data/config/locales/uk.yml +5 -14
- data/config/locales/zh-CN.yml +10 -7
- data/config/locales/zh-TW.yml +17 -9
- data/db/migrate/20181030090144_destroy_deleted_users_follows.rb +1 -1
- data/db/migrate/20181204110723_remove_following_users_count_from_users.rb +11 -2
- data/db/migrate/20181214101250_add_notification_types_to_users.rb +6 -1
- data/db/migrate/20190412131728_fix_user_names.rb +9 -2
- data/db/migrate/20200211173227_add_direct_message_types_to_users.rb +6 -1
- data/db/migrate/20210302150803_invalidate_all_sessions_for_deleted_users.rb +10 -3
- data/db/migrate/20210310120640_add_followable_counter_cache_to_users.rb +13 -3
- data/db/migrate/20231027142329_change_default_value_for_decidim_endorsements.rb +11 -0
- data/db/seeds.rb +5 -3
- data/lib/decidim/core/test/factories.rb +2 -1
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +24 -0
- data/lib/decidim/core/test/shared_examples/errors.rb +2 -0
- data/lib/decidim/core/test/shared_examples/map_examples.rb +4 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +18 -1
- data/lib/decidim/endorsable.rb +1 -1
- data/lib/decidim/exporters.rb +10 -1
- data/lib/decidim/form_builder.rb +7 -13
- data/lib/decidim/has_category.rb +2 -2
- data/lib/tasks/upgrade/decidim_deduplicate_endorsements.rake +53 -0
- data/lib/tasks/upgrade/decidim_fix_short_url_resolver.rake +22 -0
- data/lib/tasks/upgrade/decidim_user_moderation.rake +14 -0
- metadata +22 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9b09dc6caf48cd1318acfd39efaef6e9aa95ed3527ff40c3974a56f409eeff7
|
|
4
|
+
data.tar.gz: bb6ca8ea6d9b57a37d6793757cd8a12bbcffdf63afd27924216f67af1d8acb14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4003252d8eeae3f86cb4056380f4fb7aefe8a8e97f3935e97a970513ccdd05e9d6b9ca8658b56147b7bff0e306608472e656db871eae5bbb50ab9cfc1e629d4b
|
|
7
|
+
data.tar.gz: ce5aec4bd84ee34b87b5b7cc3f1afb08a1e6bcc3c34ff5cf1afa87d3ded13fe012f29a6a882fead250413f64db4a9b643770ca2c0e643e186ea51bb57a2e6c87
|
|
@@ -27,13 +27,7 @@ module Decidim
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def activities
|
|
30
|
-
@activities ||=
|
|
31
|
-
activity.visible_for?(current_user)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def last_activities
|
|
36
|
-
@last_activities ||= model.map do |activity|
|
|
30
|
+
@activities ||= model.map do |activity|
|
|
37
31
|
activity.organization_lazy
|
|
38
32
|
activity.resource_lazy
|
|
39
33
|
activity.participatory_space_lazy
|
|
@@ -56,10 +56,7 @@ module Decidim
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def activities
|
|
59
|
-
@activities ||=
|
|
60
|
-
organization: current_organization,
|
|
61
|
-
visibility: %w(public-only all)
|
|
62
|
-
).with_new_resource_type("all").order(created_at: :desc).limit(activities_to_show * 6)
|
|
59
|
+
@activities ||= Decidim::LastActivity.new(current_organization, current_user: current_user).query.limit(activities_to_show * 6)
|
|
63
60
|
end
|
|
64
61
|
|
|
65
62
|
def activities_to_show
|
|
@@ -55,7 +55,7 @@ module Decidim
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def category_path
|
|
58
|
-
resource_locator(model).index(filter: {
|
|
58
|
+
resource_locator(model).index(filter: { filter_param(:category) => [model.category.id.to_s] })
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def scope?
|
|
@@ -86,7 +86,18 @@ module Decidim
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
def scope_path
|
|
89
|
-
resource_locator(model).index(filter: {
|
|
89
|
+
resource_locator(model).index(filter: { filter_param(:scope) => [model.scope.id] })
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def filter_param(name)
|
|
93
|
+
candidates = ["with_any_#{name}".to_sym, "with_#{name}".to_sym]
|
|
94
|
+
return candidates.first unless controller.respond_to?(:default_filter_params, true)
|
|
95
|
+
|
|
96
|
+
available_params = controller.send(:default_filter_params)
|
|
97
|
+
candidates.each do |candidate|
|
|
98
|
+
return candidate if available_params.has_key?(candidate)
|
|
99
|
+
end
|
|
100
|
+
candidates.first
|
|
90
101
|
end
|
|
91
102
|
end
|
|
92
103
|
end
|
|
@@ -35,7 +35,10 @@
|
|
|
35
35
|
label: false,
|
|
36
36
|
multiple: true,
|
|
37
37
|
direct_upload: true,
|
|
38
|
-
data: {
|
|
38
|
+
data: {
|
|
39
|
+
direct_upload_url: direct_upload_url,
|
|
40
|
+
upload_validations_url: upload_validations_url
|
|
41
|
+
} %>
|
|
39
42
|
<span><%= t("decidim.forms.upload_help.dropzone") %></span>
|
|
40
43
|
</label>
|
|
41
44
|
</div>
|
|
@@ -156,15 +156,15 @@ module Decidim
|
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
def truncated_file_name_for(attachment, max_length = 31)
|
|
159
|
-
filename =
|
|
160
|
-
return filename if filename.length <= max_length
|
|
159
|
+
filename = determine_filename(attachment)
|
|
160
|
+
return decidim_html_escape(filename).html_safe if filename.length <= max_length
|
|
161
161
|
|
|
162
162
|
name = File.basename(filename, File.extname(filename))
|
|
163
|
-
name.truncate(max_length, omission: "...#{name.last((max_length / 2) - 3)}#{File.extname(filename)}")
|
|
163
|
+
decidim_html_escape(name.truncate(max_length, omission: "...#{name.last((max_length / 2) - 3)}#{File.extname(filename)}")).html_safe
|
|
164
164
|
end
|
|
165
165
|
|
|
166
166
|
def file_name_for(attachment)
|
|
167
|
-
determine_filename(attachment)
|
|
167
|
+
decidim_html_escape(determine_filename(attachment)).html_safe
|
|
168
168
|
end
|
|
169
169
|
|
|
170
170
|
def determine_filename(attachment)
|
|
@@ -205,6 +205,10 @@ module Decidim
|
|
|
205
205
|
Rails.application.class.routes.url_helpers.rails_direct_uploads_path
|
|
206
206
|
end
|
|
207
207
|
|
|
208
|
+
def upload_validations_url
|
|
209
|
+
Decidim::Core::Engine.routes.url_helpers.upload_validations_path
|
|
210
|
+
end
|
|
211
|
+
|
|
208
212
|
def form_object_class
|
|
209
213
|
form.object.class.to_s
|
|
210
214
|
end
|
|
@@ -46,8 +46,6 @@ module Decidim
|
|
|
46
46
|
attr_reader :form, :verified_email
|
|
47
47
|
|
|
48
48
|
def create_or_find_user
|
|
49
|
-
generated_password = SecureRandom.hex
|
|
50
|
-
|
|
51
49
|
@user = User.find_or_initialize_by(
|
|
52
50
|
email: verified_email,
|
|
53
51
|
organization: organization
|
|
@@ -59,6 +57,8 @@ module Decidim
|
|
|
59
57
|
# to be marked confirmed.
|
|
60
58
|
@user.skip_confirmation! if !@user.confirmed? && @user.email == verified_email
|
|
61
59
|
else
|
|
60
|
+
generated_password = SecureRandom.hex
|
|
61
|
+
|
|
62
62
|
@user.email = (verified_email || form.email)
|
|
63
63
|
@user.name = form.name
|
|
64
64
|
@user.nickname = form.normalized_nickname
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# A command that will act as a search service, with all the business logic for performing searches.
|
|
5
5
|
class Search < Decidim::Command
|
|
6
|
-
ACCEPTED_FILTERS = [:
|
|
6
|
+
ACCEPTED_FILTERS = [:decidim_scope_id_in].freeze
|
|
7
7
|
HIGHLIGHTED_RESULTS_COUNT = 4
|
|
8
8
|
|
|
9
9
|
# Public: Initializes the command.
|
|
@@ -31,7 +31,7 @@ module Decidim
|
|
|
31
31
|
query = if @current_group.present?
|
|
32
32
|
@resource.endorsements.where(decidim_user_group_id: @current_group&.id)
|
|
33
33
|
else
|
|
34
|
-
@resource.endorsements.where(author: @current_user, decidim_user_group_id:
|
|
34
|
+
@resource.endorsements.where(author: @current_user, decidim_user_group_id: 0)
|
|
35
35
|
end
|
|
36
36
|
query.destroy_all
|
|
37
37
|
end
|
|
@@ -35,11 +35,15 @@ module Decidim
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def unauthorized_paths
|
|
38
|
-
|
|
39
|
-
%w(/locale) + Decidim::StaticPage.where(
|
|
38
|
+
default_unauthorized_paths + Decidim::StaticPage.where(
|
|
40
39
|
organization: current_organization,
|
|
41
40
|
allow_public_access: true
|
|
42
41
|
).pluck(Arel.sql("CONCAT('/pages/', slug)"))
|
|
43
42
|
end
|
|
43
|
+
|
|
44
|
+
def default_unauthorized_paths
|
|
45
|
+
# /locale is for changing the locale and /manifest.webmanifest to request PWA manifest
|
|
46
|
+
%w(/locale /manifest.webmanifest)
|
|
47
|
+
end
|
|
44
48
|
end
|
|
45
49
|
end
|
|
@@ -17,7 +17,7 @@ module Decidim
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def current_component
|
|
20
|
-
@current_component ||= Decidim::Component.find(params[:component_id])
|
|
20
|
+
@current_component ||= Decidim::Component.where(participatory_space: current_organization.participatory_spaces).find(params[:component_id])
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def authorization_action
|
|
@@ -32,13 +32,7 @@ module Decidim
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def search_collection
|
|
35
|
-
|
|
36
|
-
.where(
|
|
37
|
-
organization: current_organization,
|
|
38
|
-
visibility: %w(public-only all)
|
|
39
|
-
)
|
|
40
|
-
.with_new_resource_type("all")
|
|
41
|
-
.order(created_at: :desc)
|
|
35
|
+
LastActivity.new(current_organization, current_user: current_user).query
|
|
42
36
|
end
|
|
43
37
|
|
|
44
38
|
def default_filter_params
|
|
@@ -29,7 +29,7 @@ module Decidim
|
|
|
29
29
|
#
|
|
30
30
|
# @return [Decidim::ShortLink] The short link matching the identifier
|
|
31
31
|
def link
|
|
32
|
-
@link ||= Decidim::ShortLink.find_by(identifier: params[:id])
|
|
32
|
+
@link ||= Decidim::ShortLink.find_by(identifier: params[:id], organization: current_organization)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -12,7 +12,7 @@ module Decidim
|
|
|
12
12
|
helper_method :activities, :resource_types, :user
|
|
13
13
|
|
|
14
14
|
def index
|
|
15
|
-
raise ActionController::RoutingError, "Not Found"
|
|
15
|
+
raise ActionController::RoutingError, "Not Found" unless user && current_user == user
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
private
|
|
@@ -24,7 +24,7 @@ module Decidim
|
|
|
24
24
|
validates :nickname, presence: true, format: { with: Decidim::User::REGEXP_NICKNAME }
|
|
25
25
|
|
|
26
26
|
validates :nickname, length: { maximum: Decidim::User.nickname_max_length, allow_blank: true }
|
|
27
|
-
validates :password, confirmation:
|
|
27
|
+
validates :password, confirmation: { message: I18n.t("errors.messages.password_confirmation_message") }
|
|
28
28
|
validates :password, password: { name: :name, email: :email, username: :nickname }, if: -> { password.present? }
|
|
29
29
|
validates :password_confirmation, presence: true, if: :password_present
|
|
30
30
|
validates :avatar, passthru: { to: Decidim::User }
|
|
@@ -44,16 +44,8 @@ module Decidim
|
|
|
44
44
|
allow_public_contact ? "all" : "followed-only"
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
def user_is_moderator?(user)
|
|
48
|
-
Decidim.participatory_space_manifests.map do |manifest|
|
|
49
|
-
participatory_space_type = manifest.model_class_name.constantize
|
|
50
|
-
return true if participatory_space_type.moderators(user.organization).exists?(id: user.id)
|
|
51
|
-
end
|
|
52
|
-
false
|
|
53
|
-
end
|
|
54
|
-
|
|
55
47
|
def meet_push_notifications_requirements?
|
|
56
|
-
Rails.application.secrets.vapid
|
|
48
|
+
Rails.application.secrets.dig(:vapid, :enabled) || false
|
|
57
49
|
end
|
|
58
50
|
end
|
|
59
51
|
end
|
|
@@ -17,7 +17,7 @@ module Decidim
|
|
|
17
17
|
validates :name, presence: true, format: { with: Decidim::User::REGEXP_NAME }
|
|
18
18
|
validates :nickname, presence: true, format: { with: Decidim::User::REGEXP_NICKNAME }, length: { maximum: Decidim::User.nickname_max_length }
|
|
19
19
|
validates :email, presence: true, "valid_email_2/email": { disposable: true }
|
|
20
|
-
validates :password, confirmation:
|
|
20
|
+
validates :password, confirmation: { message: I18n.t("errors.messages.password_confirmation_message") }
|
|
21
21
|
validates :password, password: { name: :name, email: :email, username: :nickname }
|
|
22
22
|
validates :password_confirmation, presence: true
|
|
23
23
|
validates :tos_agreement, allow_nil: false, acceptance: true
|
data/app/forms/url_validator.rb
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
#
|
|
7
7
|
class UrlValidator < ActiveModel::EachValidator
|
|
8
8
|
def validate_each(record, attribute, value)
|
|
9
|
-
record.errors.add attribute,
|
|
9
|
+
record.errors.add attribute, :url_format, **options unless url_valid?(value)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
# a URL may be technically well-formed but may
|
|
@@ -105,7 +105,10 @@ module Decidim
|
|
|
105
105
|
# non-nil because otherwise it will be set to the asset host at
|
|
106
106
|
# ActionView::Helpers::AssetUrlHelper#compute_asset_host.
|
|
107
107
|
img_path = asset_pack_path(path, host: "", protocol: :relative)
|
|
108
|
-
Rails.public_path.join(img_path.sub(%r{^/}, ""))
|
|
108
|
+
path = Rails.public_path.join(img_path.sub(%r{^/}, ""))
|
|
109
|
+
return unless File.exist?(path)
|
|
110
|
+
|
|
111
|
+
path
|
|
109
112
|
rescue ::Webpacker::Manifest::MissingEntryError
|
|
110
113
|
nil
|
|
111
114
|
end
|
|
@@ -67,6 +67,8 @@ module Decidim
|
|
|
67
67
|
|
|
68
68
|
# Returns an instance of ResourceLocatorPresenter with the given resource
|
|
69
69
|
def resource_locator(resource)
|
|
70
|
+
return resource.resource_locator if resource.respond_to?(:resource_locator)
|
|
71
|
+
|
|
70
72
|
::Decidim::ResourceLocatorPresenter.new(resource)
|
|
71
73
|
end
|
|
72
74
|
|
|
@@ -21,7 +21,7 @@ module Decidim
|
|
|
21
21
|
target ||= respond_to?(:current_organization) && current_organization
|
|
22
22
|
target ||= Rails.application
|
|
23
23
|
|
|
24
|
-
mounted_engine = EngineResolver.new(_routes).mounted_name
|
|
24
|
+
mounted_engine = target.try(:mounted_engine) || EngineResolver.new(_routes).mounted_name
|
|
25
25
|
ShortLink.to(target, mounted_engine, **kwargs).short_url
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -11,6 +11,8 @@ module Decidim
|
|
|
11
11
|
raise "Couldn't generate Open Data export" unless exporter.export.positive?
|
|
12
12
|
|
|
13
13
|
organization.open_data_file.attach(io: File.open(path, "rb"), filename: organization.open_data_file_path)
|
|
14
|
+
# Deletes the temporary file file
|
|
15
|
+
File.delete(path)
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
end
|
|
@@ -87,6 +87,12 @@ module Decidim
|
|
|
87
87
|
@top_scopes ||= scopes.top_level
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
+
def participatory_spaces
|
|
91
|
+
@participatory_spaces ||= Decidim.participatory_space_manifests.flat_map do |manifest|
|
|
92
|
+
manifest.participatory_spaces.call(self)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
90
96
|
def public_participatory_spaces
|
|
91
97
|
@public_participatory_spaces ||= Decidim.participatory_space_manifests.flat_map do |manifest|
|
|
92
98
|
manifest.participatory_spaces.call(self).public_spaces
|
data/app/models/decidim/user.rb
CHANGED
|
@@ -205,7 +205,7 @@ module Decidim
|
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
def admin_terms_accepted?
|
|
208
|
-
|
|
208
|
+
admin_terms_accepted_at.present?
|
|
209
209
|
end
|
|
210
210
|
|
|
211
211
|
# Whether this user can be verified against some authorization or not.
|
|
@@ -261,13 +261,22 @@ module Decidim
|
|
|
261
261
|
end
|
|
262
262
|
|
|
263
263
|
def needs_password_update?
|
|
264
|
+
return false if organization.users_registration_mode == "disabled"
|
|
264
265
|
return false unless admin?
|
|
265
266
|
return false unless Decidim.config.admin_password_strong
|
|
266
|
-
return
|
|
267
|
+
return identities.none? if password_updated_at.blank?
|
|
267
268
|
|
|
268
269
|
password_updated_at < Decidim.config.admin_password_expiration_days.days.ago
|
|
269
270
|
end
|
|
270
271
|
|
|
272
|
+
def moderator?
|
|
273
|
+
Decidim.participatory_space_manifests.map do |manifest|
|
|
274
|
+
participatory_space_type = manifest.model_class_name.constantize
|
|
275
|
+
return true if participatory_space_type.moderators(organization).exists?(id: id)
|
|
276
|
+
end
|
|
277
|
+
false
|
|
278
|
+
end
|
|
279
|
+
|
|
271
280
|
protected
|
|
272
281
|
|
|
273
282
|
# Overrides devise email required validation.
|
|
@@ -293,7 +302,8 @@ module Decidim
|
|
|
293
302
|
event: "decidim.events.core.welcome_notification",
|
|
294
303
|
event_class: WelcomeNotificationEvent,
|
|
295
304
|
resource: self,
|
|
296
|
-
affected_users: [self]
|
|
305
|
+
affected_users: [self],
|
|
306
|
+
extra: { force_email: true }
|
|
297
307
|
)
|
|
298
308
|
end
|
|
299
309
|
|