decidim-core 0.27.2 → 0.27.4
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.
- 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/files.erb +1 -0
- data/app/cells/decidim/upload_modal_cell.rb +14 -4
- data/app/commands/decidim/attachment_methods.rb +20 -2
- data/app/commands/decidim/create_omniauth_registration.rb +2 -2
- data/app/commands/decidim/create_registration.rb +1 -0
- data/app/commands/decidim/gallery_methods.rb +1 -1
- data/app/commands/decidim/update_account.rb +1 -0
- data/app/commands/decidim/update_password.rb +2 -0
- data/app/controllers/decidim/authorization_modals_controller.rb +1 -1
- data/app/controllers/decidim/devise/sessions_controller.rb +18 -2
- data/app/controllers/decidim/last_activities_controller.rb +1 -7
- data/app/controllers/decidim/links_controller.rb +8 -11
- data/app/controllers/decidim/short_links_controller.rb +1 -1
- data/app/forms/decidim/notifications_settings_form.rb +1 -1
- data/app/forms/url_validator.rb +1 -1
- data/app/helpers/decidim/cells_helper.rb +1 -0
- data/app/helpers/decidim/external_domain_helper.rb +14 -3
- data/app/helpers/decidim/layout_helper.rb +4 -1
- data/app/helpers/decidim/layout_helper.rb.orig +225 -0
- data/app/helpers/decidim/sanitize_helper.rb +3 -2
- data/app/models/decidim/organization.rb +6 -0
- data/app/models/decidim/scope_type.rb +24 -0
- data/app/models/decidim/user.rb +4 -2
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +0 -1
- data/app/packs/src/decidim/editor/clipboard_override.js +6 -2
- data/app/packs/src/decidim/editor.js +63 -33
- 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/stylesheets/decidim/modules/_buttons.scss +10 -6
- data/app/packs/stylesheets/decidim/modules/_cards.scss +1 -1
- data/app/packs/stylesheets/decidim/modules/_comments.scss +24 -0
- data/app/packs/stylesheets/decidim/modules/_dropdown_menu.scss +9 -0
- data/app/packs/stylesheets/decidim/modules/_input-gallery.scss +2 -1
- data/app/packs/stylesheets/decidim/modules/_upload_modal.scss +0 -4
- data/app/packs/stylesheets/decidim/vizzs/_linechart.scss +2 -2
- data/app/packs/stylesheets/decidim/vizzs/_rowchart.scss +2 -2
- data/app/presenters/decidim/notification_presenter.rb +1 -1
- data/app/presenters/decidim/notification_to_mailer_presenter.rb +1 -0
- data/app/presenters/decidim/user_group_presenter.rb +1 -1
- data/app/presenters/decidim/user_presenter.rb +1 -1
- 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/scrubbers/decidim/admin_input_scrubber.rb +3 -1
- data/app/scrubbers/decidim/user_input_scrubber.rb +30 -1
- data/app/services/decidim/email_notification_generator.rb +7 -1
- data/app/services/decidim/send_push_notification.rb +1 -1
- data/app/services/decidim/traceability.rb +1 -0
- data/app/uploaders/decidim/application_uploader.rb +2 -0
- data/app/validators/uploader_image_dimensions_validator.rb +22 -2
- data/app/views/decidim/devise/registrations/new.html.erb.orig +231 -0
- data/app/views/decidim/links/_invalid_url_modal.html.erb +17 -0
- data/app/views/decidim/links/_modal.html.erb +1 -1
- data/app/views/decidim/links/invalid_url.js.erb +24 -0
- data/app/views/decidim/links/new.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_conversation.html.erb +1 -5
- data/config/environment.rb +0 -0
- data/config/locales/ar.yml +567 -4
- data/config/locales/bg.yml +5 -4
- data/config/locales/ca.yml +27 -22
- data/config/locales/cs.yml +41 -33
- data/config/locales/da.yml +4 -0
- data/config/locales/de.yml +66 -21
- data/config/locales/el.yml +147 -2
- data/config/locales/en.yml +17 -13
- data/config/locales/eo.yml +5 -1
- data/config/locales/es-MX.yml +22 -17
- data/config/locales/es-PY.yml +24 -19
- data/config/locales/es.yml +26 -21
- data/config/locales/et.yml +4 -0
- data/config/locales/eu.yml +154 -63
- data/config/locales/fa-IR.yml +1 -0
- data/config/locales/fi-plain.yml +17 -12
- data/config/locales/fi.yml +20 -15
- data/config/locales/fr-CA.yml +29 -21
- data/config/locales/fr.yml +28 -20
- data/config/locales/ga-IE.yml +5 -0
- data/config/locales/gl.yml +8 -22
- data/config/locales/gn-PY.yml +4 -0
- data/config/locales/hr.yml +4 -0
- data/config/locales/hu.yml +82 -20
- data/config/locales/id-ID.yml +10 -4
- data/config/locales/is-IS.yml +5 -2
- data/config/locales/it.yml +9 -9
- data/config/locales/ja.yml +18 -14
- data/config/locales/ka-GE.yml +4 -0
- data/config/locales/kaa.yml +11 -0
- data/config/locales/lb.yml +12 -12
- data/config/locales/lt.yml +1 -35
- data/config/locales/lv.yml +4 -3
- data/config/locales/nl.yml +5 -27
- data/config/locales/no.yml +9 -27
- data/config/locales/oc-FR.yml +3 -0
- data/config/locales/pl.yml +4 -34
- data/config/locales/pt-BR.yml +7 -7
- data/config/locales/pt.yml +5 -5
- data/config/locales/ro-RO.yml +40 -4
- data/config/locales/ru.yml +3 -3
- data/config/locales/sk.yml +22 -10
- data/config/locales/sl.yml +1 -0
- data/config/locales/sr-CS.yml +10 -0
- data/config/locales/sv.yml +11 -33
- data/config/locales/tr-TR.yml +7 -7
- data/config/locales/uk.yml +3 -3
- data/config/locales/zh-CN.yml +4 -4
- data/config/locales/zh-TW.yml +1886 -0
- 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/seeds.rb +4 -3
- data/lib/decidim/asset_router/pipeline.rb +2 -0
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +36 -0
- data/lib/decidim/core/test/shared_examples/digest_mail_examples.rb +33 -0
- data/lib/decidim/core/test/shared_examples/editor_shared_examples.rb +5 -4
- data/lib/decidim/core/test/shared_examples/map_examples.rb +4 -1
- data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +7 -3
- data/lib/decidim/core/test.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +17 -0
- data/lib/decidim/form_builder.rb +10 -16
- data/lib/decidim/publicable.rb +4 -0
- data/lib/tasks/upgrade/decidim_user_moderation.rake +14 -0
- metadata +23 -12
@@ -10,7 +10,7 @@ class DestroyDeletedUsersFollows < ActiveRecord::Migration[5.2]
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def change
|
13
|
-
deleted_users =
|
13
|
+
deleted_users = User.where.not(deleted_at: nil).pluck(:id)
|
14
14
|
Follow.where(decidim_followable_type: "Decidim::UserBaseEntity", decidim_followable_id: deleted_users).destroy_all
|
15
15
|
Follow.where(decidim_user_id: deleted_users).destroy_all
|
16
16
|
end
|
@@ -1,6 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class RemoveFollowingUsersCountFromUsers < ActiveRecord::Migration[5.2]
|
4
|
+
class UserBaseEntity < ApplicationRecord
|
5
|
+
self.table_name = :decidim_users
|
6
|
+
self.inheritance_column = nil # disable the default inheritance
|
7
|
+
end
|
8
|
+
|
9
|
+
class Follow < ApplicationRecord
|
10
|
+
self.table_name = :decidim_follows
|
11
|
+
end
|
12
|
+
|
4
13
|
def up
|
5
14
|
remove_column :decidim_users, :following_users_count
|
6
15
|
end
|
@@ -8,8 +17,8 @@ class RemoveFollowingUsersCountFromUsers < ActiveRecord::Migration[5.2]
|
|
8
17
|
def down
|
9
18
|
add_column :decidim_users, :following_users_count, :integer, null: false, default: 0
|
10
19
|
|
11
|
-
|
12
|
-
following_users_count =
|
20
|
+
UserBaseEntity.find_each do |entity|
|
21
|
+
following_users_count = Follow.where(decidim_user_id: entity.id, decidim_followable_type: ["Decidim::UserBaseEntity", "Decidim::User", "Decidim::UserGroup"]).count
|
13
22
|
entity.following_users_count = following_users_count
|
14
23
|
entity.save
|
15
24
|
end
|
@@ -1,10 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class AddNotificationTypesToUsers < ActiveRecord::Migration[5.2]
|
4
|
+
class UserBaseEntity < ApplicationRecord
|
5
|
+
self.table_name = :decidim_users
|
6
|
+
self.inheritance_column = nil # disable the default inheritance
|
7
|
+
end
|
8
|
+
|
4
9
|
def change
|
5
10
|
add_column :decidim_users, :notification_types, :string, default: "all"
|
6
11
|
# rubocop:disable Rails/SkipsModelValidations
|
7
|
-
|
12
|
+
UserBaseEntity.update_all(notification_types: "all")
|
8
13
|
# rubocop:enable Rails/SkipsModelValidations
|
9
14
|
|
10
15
|
change_column_null :decidim_users, :notification_types, false
|
@@ -1,6 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class FixUserNames < ActiveRecord::Migration[5.2]
|
4
|
+
class UserBaseEntity < ApplicationRecord
|
5
|
+
include Decidim::Nicknamizable
|
6
|
+
|
7
|
+
self.table_name = :decidim_users
|
8
|
+
self.inheritance_column = nil # disable the default inheritance
|
9
|
+
end
|
10
|
+
|
4
11
|
def change
|
5
12
|
# Comes from Decidim::User specs
|
6
13
|
weird_characters =
|
@@ -8,7 +15,7 @@ class FixUserNames < ActiveRecord::Migration[5.2]
|
|
8
15
|
characters_to_remove = "<>?%&^*\#@()[]=+:;\"{}\\|/"
|
9
16
|
|
10
17
|
weird_characters.each do |character|
|
11
|
-
|
18
|
+
UserBaseEntity.where(deleted_at: nil).where("name like '%#{character}%' escape '\' OR nickname like '%#{character}%' escape '\'").find_each do |entity|
|
12
19
|
Rails.logger.debug { "detected character: #{character}" }
|
13
20
|
Rails.logger.debug { "UserBaseEntity ID: #{entity.id}" }
|
14
21
|
Rails.logger.debug { "#{entity.name} => #{entity.name.delete(characters_to_remove).strip}" }
|
@@ -16,7 +23,7 @@ class FixUserNames < ActiveRecord::Migration[5.2]
|
|
16
23
|
|
17
24
|
entity.name = entity.name.delete(characters_to_remove).strip
|
18
25
|
sanitized_nickname = entity.nickname.delete(characters_to_remove).strip
|
19
|
-
entity.nickname =
|
26
|
+
entity.nickname = UserBaseEntity.nicknamize(sanitized_nickname, organization: entity.organization)
|
20
27
|
entity.save(validate: false)
|
21
28
|
end
|
22
29
|
end
|
@@ -1,10 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class AddDirectMessageTypesToUsers < ActiveRecord::Migration[5.2]
|
4
|
+
class UserBaseEntity < ApplicationRecord
|
5
|
+
self.table_name = :decidim_users
|
6
|
+
self.inheritance_column = nil # disable the default inheritance
|
7
|
+
end
|
8
|
+
|
4
9
|
def change
|
5
10
|
add_column :decidim_users, :direct_message_types, :string, default: "all"
|
6
11
|
# rubocop:disable Rails/SkipsModelValidations
|
7
|
-
|
12
|
+
UserBaseEntity.update_all(direct_message_types: "all")
|
8
13
|
# rubocop:enable Rails/SkipsModelValidations
|
9
14
|
|
10
15
|
change_column_null :decidim_users, :direct_message_types, false
|
@@ -1,10 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class InvalidateAllSessionsForDeletedUsers < ActiveRecord::Migration[5.2]
|
4
|
-
|
5
|
-
|
4
|
+
class User < ApplicationRecord
|
5
|
+
self.table_name = "decidim_users"
|
6
|
+
self.inheritance_column = nil # disable the default inheritance
|
7
|
+
|
8
|
+
default_scope { where(type: "Decidim::User") }
|
9
|
+
end
|
6
10
|
|
7
|
-
|
11
|
+
def up
|
12
|
+
User.where.not(deleted_at: nil).find_each do |user|
|
13
|
+
user.update!(session_token: SecureRandom.hex)
|
14
|
+
end
|
8
15
|
end
|
9
16
|
|
10
17
|
def down; end
|
@@ -1,14 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class AddFollowableCounterCacheToUsers < ActiveRecord::Migration[5.2]
|
4
|
+
class Follow < ApplicationRecord
|
5
|
+
self.table_name = "decidim_follows"
|
6
|
+
end
|
7
|
+
|
8
|
+
class User < ApplicationRecord
|
9
|
+
self.table_name = "decidim_users"
|
10
|
+
self.inheritance_column = nil # disable the default inheritance
|
11
|
+
|
12
|
+
default_scope { where(type: "Decidim::User") }
|
13
|
+
end
|
14
|
+
|
4
15
|
def change
|
5
16
|
add_column :decidim_users, :follows_count, :integer, null: false, default: 0, index: true
|
6
17
|
|
7
18
|
reversible do |dir|
|
8
19
|
dir.up do
|
9
|
-
|
10
|
-
|
11
|
-
record.class.reset_counters(record.id, :follows)
|
20
|
+
User.find_each do |record|
|
21
|
+
record.update!(follows_count: Follow.where(decidim_user_id: record.id).count)
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
data/db/seeds.rb
CHANGED
@@ -125,7 +125,8 @@ if !Rails.env.production? || ENV.fetch("SEED", nil)
|
|
125
125
|
tos_agreement: true,
|
126
126
|
personal_url: Faker::Internet.url,
|
127
127
|
about: Faker::Lorem.paragraph(sentence_count: 2),
|
128
|
-
accepted_tos_version: organization.tos_version,
|
128
|
+
accepted_tos_version: organization.tos_version + 1.hour,
|
129
|
+
password_updated_at: Time.current,
|
129
130
|
admin_terms_accepted_at: Time.current
|
130
131
|
}
|
131
132
|
admin_hash.merge!(password: "decidim123456789", password_confirmation: "decidim123456789") if admin.encrypted_password.blank?
|
@@ -143,7 +144,7 @@ if !Rails.env.production? || ENV.fetch("SEED", nil)
|
|
143
144
|
tos_agreement: true,
|
144
145
|
personal_url: Faker::Internet.url,
|
145
146
|
about: Faker::Lorem.paragraph(sentence_count: 2),
|
146
|
-
accepted_tos_version: organization.tos_version
|
147
|
+
accepted_tos_version: organization.tos_version + 1.hour
|
147
148
|
)
|
148
149
|
end
|
149
150
|
|
@@ -162,7 +163,7 @@ if !Rails.env.production? || ENV.fetch("SEED", nil)
|
|
162
163
|
tos_agreement: true,
|
163
164
|
personal_url: Faker::Internet.url,
|
164
165
|
about: Faker::Lorem.paragraph(sentence_count: 2),
|
165
|
-
accepted_tos_version: organization.tos_version
|
166
|
+
accepted_tos_version: organization.tos_version + 1.hour
|
166
167
|
)
|
167
168
|
|
168
169
|
locked_user.lock_access!
|
@@ -416,6 +416,42 @@ shared_examples "comments" do
|
|
416
416
|
)
|
417
417
|
end
|
418
418
|
|
419
|
+
context "when user can hide replies on a thread" do
|
420
|
+
let(:thread) { comments.first }
|
421
|
+
let(:new_reply_body) { "Hey, I just jumped inside the thread!" }
|
422
|
+
let!(:new_reply) { create(:comment, commentable: thread, root_commentable: commentable, body: new_reply_body) }
|
423
|
+
|
424
|
+
it "displays the hide button" do
|
425
|
+
visit current_path
|
426
|
+
within "#comment_#{thread.id}" do
|
427
|
+
expect(page).to have_content("Hide replies")
|
428
|
+
expect(page).to have_content(new_reply_body)
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
it "displays the show button" do
|
433
|
+
visit current_path
|
434
|
+
within "#comment_#{thread.id}" do
|
435
|
+
click_button "Hide replies"
|
436
|
+
expect(page).to have_content("Show reply")
|
437
|
+
expect(page).not_to have_content(new_reply_body)
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
context "when are more replies" do
|
442
|
+
let!(:new_replies) { create_list(:comment, 2, commentable: thread, root_commentable: commentable, body: new_reply_body) }
|
443
|
+
|
444
|
+
it "displays the show button" do
|
445
|
+
visit current_path
|
446
|
+
within "#comment_#{thread.id}" do
|
447
|
+
click_button "Hide replies"
|
448
|
+
expect(page).to have_content("Show 3 replies")
|
449
|
+
expect(page).not_to have_content(new_reply_body)
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
419
455
|
context "when inside a thread reply form" do
|
420
456
|
let(:thread) { comments.first }
|
421
457
|
let(:new_reply_body) { "Hey, I just jumped inside the thread!" }
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_context "when sends the notification digest" do
|
4
|
+
context "when daily notification mail" do
|
5
|
+
let(:user) { create(:user, :admin, organization: organization, notifications_sending_frequency: "daily") }
|
6
|
+
|
7
|
+
it_behaves_like "notification digest mail"
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when weekly notification mail" do
|
11
|
+
let(:user) { create(:user, :admin, organization: organization, notifications_sending_frequency: "weekly") }
|
12
|
+
|
13
|
+
it_behaves_like "notification digest mail"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
shared_examples_for "notification digest mail" do
|
18
|
+
context "when a notificable event takes place" do
|
19
|
+
let!(:organization) { create(:organization) }
|
20
|
+
let!(:participatory_space) { create(:participatory_process, organization: organization) }
|
21
|
+
|
22
|
+
it "sends a notification to the user's email" do
|
23
|
+
perform_enqueued_jobs do
|
24
|
+
expect(command.call).to broadcast(:ok)
|
25
|
+
Decidim::Notification.last.update(created_at: 1.day.ago)
|
26
|
+
Decidim::EmailNotificationsDigestGeneratorJob.perform_now(user.id, user.notifications_sending_frequency)
|
27
|
+
end
|
28
|
+
|
29
|
+
expect(last_email_body.length).to be_positive
|
30
|
+
expect(last_email_body).not_to include("translation missing")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
shared_examples_for "has embedded video in description" do |description_attribute_name|
|
3
|
+
shared_examples_for "has embedded video in description" do |description_attribute_name, count: 1|
|
4
4
|
let(description_attribute_name) { { en: %(Description <iframe class="ql-video" allowfullscreen="true" src="#{iframe_src}" frameborder="0"></iframe>) } }
|
5
5
|
let(:iframe_src) { "http://www.example.org" }
|
6
|
+
let!(:cookie_warning) { "You need to enable all cookies in order to see this content" }
|
6
7
|
|
7
8
|
context "when cookies are rejected" do
|
8
9
|
before do
|
@@ -11,7 +12,7 @@ shared_examples_for "has embedded video in description" do |description_attribut
|
|
11
12
|
end
|
12
13
|
|
13
14
|
it "disables iframe" do
|
14
|
-
expect(page).to have_content(
|
15
|
+
expect(page).to have_content(cookie_warning)
|
15
16
|
expect(page).not_to have_selector("iframe")
|
16
17
|
end
|
17
18
|
end
|
@@ -23,8 +24,8 @@ shared_examples_for "has embedded video in description" do |description_attribut
|
|
23
24
|
end
|
24
25
|
|
25
26
|
it "shows iframe" do
|
26
|
-
expect(page).not_to have_content(
|
27
|
-
expect(page).to have_selector("iframe", count:
|
27
|
+
expect(page).not_to have_content(cookie_warning)
|
28
|
+
expect(page).to have_selector("iframe", count: count)
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
@@ -10,7 +10,9 @@ shared_context "with map utility" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
shared_context "with frontend map builder" do
|
13
|
-
subject {
|
13
|
+
subject { builder_class.new(template, options) }
|
14
|
+
|
15
|
+
let(:builder_class) { described_class }
|
14
16
|
|
15
17
|
let(:template_class) do
|
16
18
|
Class.new(ActionView::Base) do
|
@@ -102,6 +104,7 @@ shared_context "with frontend map elements" do
|
|
102
104
|
# context.
|
103
105
|
final_html = html_document
|
104
106
|
Rails.application.routes.draw do
|
107
|
+
get "maptiles/:z/:x/:y.png", to: ->(_) { [200, {}, [final_html]] }
|
105
108
|
get "test_dynamic_map", to: ->(_) { [200, {}, [final_html]] }
|
106
109
|
get "offline", to: ->(_) { [200, {}, [""]] }
|
107
110
|
end
|
@@ -1,13 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
shared_examples "having a rich text editor" do |
|
4
|
-
it "has a
|
5
|
-
within
|
3
|
+
shared_examples "having a rich text editor for field" do |selector, toolbar|
|
4
|
+
it "has a rich text editor" do
|
5
|
+
within selector do
|
6
6
|
expect(page).to have_selector("div.editor-container[data-toolbar='#{toolbar}']", visible: :all)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
shared_examples "having a rich text editor" do |css, toolbar|
|
12
|
+
it_behaves_like "having a rich text editor for field", "form.#{css}", toolbar
|
13
|
+
end
|
14
|
+
|
11
15
|
shared_context "with rich text editor content" do
|
12
16
|
let(:content) { "<p>#{safe_tags}</p>#{script}" }
|
13
17
|
let(:safe_tags) { em + u + strong }
|
data/lib/decidim/core/test.rb
CHANGED
@@ -75,3 +75,4 @@ require "decidim/core/test/shared_examples/conversations_examples"
|
|
75
75
|
require "decidim/core/test/shared_examples/resource_endorsed_event_examples"
|
76
76
|
require "decidim/core/test/shared_examples/versions_controller_examples"
|
77
77
|
require "decidim/core/test/shared_examples/mcell_examples"
|
78
|
+
require "decidim/core/test/shared_examples/digest_mail_examples"
|
data/lib/decidim/core/version.rb
CHANGED
data/lib/decidim/core.rb
CHANGED
@@ -118,6 +118,12 @@ module Decidim
|
|
118
118
|
include ActiveSupport::Configurable
|
119
119
|
# Loads seeds from all engines.
|
120
120
|
def self.seed!
|
121
|
+
# After running the migrations, some records may have loaded their column
|
122
|
+
# caches at different stages of the migration process, so in order to
|
123
|
+
# prevent any "undefined method" errors if these tasks are run
|
124
|
+
# consecutively, reset the column cache before the migrations.
|
125
|
+
reset_all_column_information
|
126
|
+
|
121
127
|
# Faker needs to have the `:en` locale in order to work properly, so we
|
122
128
|
# must enforce it during the seeds.
|
123
129
|
original_locale = I18n.available_locales
|
@@ -157,6 +163,17 @@ module Decidim
|
|
157
163
|
I18n.available_locales = original_locale
|
158
164
|
end
|
159
165
|
|
166
|
+
# Finds all currently loaded Decidim ActiveRecord classes and resets their
|
167
|
+
# column information.
|
168
|
+
def self.reset_all_column_information
|
169
|
+
ActiveRecord::Base.descendants.each do |cls|
|
170
|
+
next if cls.name.nil? # abstract classes registered during tests
|
171
|
+
next if cls.abstract_class? || !cls.name.match?(/^Decidim::/)
|
172
|
+
|
173
|
+
cls.reset_column_information
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
160
177
|
# Exposes a configuration option: The application name String.
|
161
178
|
config_accessor :application_name
|
162
179
|
|
data/lib/decidim/form_builder.rb
CHANGED
@@ -181,7 +181,6 @@ module Decidim
|
|
181
181
|
# or 'full' (optional) (default: 'basic')
|
182
182
|
# :lines - The Integer to indicate how many lines should editor have (optional) (default: 10)
|
183
183
|
# :disabled - Whether the editor should be disabled
|
184
|
-
# :editor_images - Allow attached images (optional) (default: false)
|
185
184
|
#
|
186
185
|
# Renders a container with both hidden field and editor container
|
187
186
|
def editor(name, options = {})
|
@@ -199,9 +198,12 @@ module Decidim
|
|
199
198
|
template += label(name, label_text + required_for_attribute(name)) if options.fetch(:label, true)
|
200
199
|
template += hidden_field(name, hidden_options)
|
201
200
|
template += content_tag(:div, nil, class: "editor-container #{"js-hashtags" if hashtaggable}", data: {
|
202
|
-
|
203
|
-
|
204
|
-
|
201
|
+
toolbar: toolbar,
|
202
|
+
disabled: options[:disabled],
|
203
|
+
editor_images: true,
|
204
|
+
upload_images_path: Decidim::Core::Engine.routes.url_helpers.editor_images_path,
|
205
|
+
drag_and_drop_help_text: I18n.t("drag_and_drop_help", scope: "decidim.editor_images")
|
206
|
+
}, style: "height: #{lines}rem")
|
205
207
|
template += error_for(name, options) if error?(name)
|
206
208
|
template.html_safe
|
207
209
|
end
|
@@ -444,7 +446,7 @@ module Decidim
|
|
444
446
|
# * resouce_name: Name of the resource (e.g. user)
|
445
447
|
# * resource_class: Attribute's resource class (e.g. Decidim::User)
|
446
448
|
# * resouce_class: Class of the resource (e.g. user)
|
447
|
-
# *
|
449
|
+
# * required: Whether the file is required or not (false by default).
|
448
450
|
# * titled: Whether the file can have title or not.
|
449
451
|
# * show_current: Whether the current file is displayed next to the button.
|
450
452
|
# * help: Array of help messages which are displayed inside of the upload modal.
|
@@ -464,7 +466,7 @@ module Decidim
|
|
464
466
|
attribute: attribute,
|
465
467
|
resource_name: @object_name,
|
466
468
|
resource_class: options[:resource_class]&.to_s || resource_class(attribute),
|
467
|
-
|
469
|
+
required: false,
|
468
470
|
titled: false,
|
469
471
|
show_current: true,
|
470
472
|
max_file_size: max_file_size,
|
@@ -712,6 +714,8 @@ module Decidim
|
|
712
714
|
safe_join([yield, text.html_safe])
|
713
715
|
elsif block_given?
|
714
716
|
safe_join([text.html_safe, yield])
|
717
|
+
else
|
718
|
+
text
|
715
719
|
end
|
716
720
|
|
717
721
|
label(attribute, text, options || {})
|
@@ -924,16 +928,6 @@ module Decidim
|
|
924
928
|
end
|
925
929
|
end
|
926
930
|
|
927
|
-
def editor_images_options(options)
|
928
|
-
return {} unless options[:editor_images]
|
929
|
-
|
930
|
-
{
|
931
|
-
editor_images: true,
|
932
|
-
upload_images_path: Decidim::Core::Engine.routes.url_helpers.editor_images_path,
|
933
|
-
drag_and_drop_help_text: I18n.t("drag_and_drop_help", scope: "decidim.editor_images")
|
934
|
-
}
|
935
|
-
end
|
936
|
-
|
937
931
|
# Private: Determines the correct resource class for validators from the
|
938
932
|
# object or its PassthruValidator.
|
939
933
|
def resource_class(attribute)
|
data/lib/decidim/publicable.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :decidim do
|
4
|
+
namespace :upgrade do
|
5
|
+
namespace :moderation do
|
6
|
+
desc "Add all blocked users to global moderation panel"
|
7
|
+
task fix_blocked_user_panel: :environment do
|
8
|
+
Decidim::UserBlock.find_each do |blocked_user|
|
9
|
+
Decidim::UserModeration.where(user: blocked_user.user).first_or_create!
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.
|
4
|
+
version: 0.27.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
8
8
|
- Marc Riera Casals
|
9
9
|
- Oriol Gual Oliva
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-07-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: active_link_to
|
@@ -324,14 +324,14 @@ dependencies:
|
|
324
324
|
requirements:
|
325
325
|
- - "~>"
|
326
326
|
- !ruby/object:Gem::Version
|
327
|
-
version: 2.
|
327
|
+
version: 2.19.0
|
328
328
|
type: :runtime
|
329
329
|
prerelease: false
|
330
330
|
version_requirements: !ruby/object:Gem::Requirement
|
331
331
|
requirements:
|
332
332
|
- - "~>"
|
333
333
|
- !ruby/object:Gem::Version
|
334
|
-
version: 2.
|
334
|
+
version: 2.19.0
|
335
335
|
- !ruby/object:Gem::Dependency
|
336
336
|
name: mime-types
|
337
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -740,28 +740,28 @@ dependencies:
|
|
740
740
|
requirements:
|
741
741
|
- - '='
|
742
742
|
- !ruby/object:Gem::Version
|
743
|
-
version: 0.27.
|
743
|
+
version: 0.27.4
|
744
744
|
type: :runtime
|
745
745
|
prerelease: false
|
746
746
|
version_requirements: !ruby/object:Gem::Requirement
|
747
747
|
requirements:
|
748
748
|
- - '='
|
749
749
|
- !ruby/object:Gem::Version
|
750
|
-
version: 0.27.
|
750
|
+
version: 0.27.4
|
751
751
|
- !ruby/object:Gem::Dependency
|
752
752
|
name: decidim-dev
|
753
753
|
requirement: !ruby/object:Gem::Requirement
|
754
754
|
requirements:
|
755
755
|
- - '='
|
756
756
|
- !ruby/object:Gem::Version
|
757
|
-
version: 0.27.
|
757
|
+
version: 0.27.4
|
758
758
|
type: :development
|
759
759
|
prerelease: false
|
760
760
|
version_requirements: !ruby/object:Gem::Requirement
|
761
761
|
requirements:
|
762
762
|
- - '='
|
763
763
|
- !ruby/object:Gem::Version
|
764
|
-
version: 0.27.
|
764
|
+
version: 0.27.4
|
765
765
|
description: Adds core features so other engines can hook into the framework.
|
766
766
|
email:
|
767
767
|
- josepjaume@gmail.com
|
@@ -1201,6 +1201,7 @@ files:
|
|
1201
1201
|
- app/helpers/decidim/icon_helper.rb
|
1202
1202
|
- app/helpers/decidim/language_chooser_helper.rb
|
1203
1203
|
- app/helpers/decidim/layout_helper.rb
|
1204
|
+
- app/helpers/decidim/layout_helper.rb.orig
|
1204
1205
|
- app/helpers/decidim/localized_locales_helper.rb
|
1205
1206
|
- app/helpers/decidim/map_helper.rb
|
1206
1207
|
- app/helpers/decidim/markup_helper.rb
|
@@ -1563,6 +1564,7 @@ files:
|
|
1563
1564
|
- app/packs/stylesheets/decidim/modules/_datepicker.scss
|
1564
1565
|
- app/packs/stylesheets/decidim/modules/_definition-data.scss
|
1565
1566
|
- app/packs/stylesheets/decidim/modules/_docs-manager.scss
|
1567
|
+
- app/packs/stylesheets/decidim/modules/_dropdown_menu.scss
|
1566
1568
|
- app/packs/stylesheets/decidim/modules/_extra.scss
|
1567
1569
|
- app/packs/stylesheets/decidim/modules/_filter-tags.scss
|
1568
1570
|
- app/packs/stylesheets/decidim/modules/_filters.scss
|
@@ -1701,6 +1703,7 @@ files:
|
|
1701
1703
|
- app/presenters/decidim/user_group_presenter.rb
|
1702
1704
|
- app/presenters/decidim/user_presenter.rb
|
1703
1705
|
- app/presenters/decidim/validation_errors_presenter.rb
|
1706
|
+
- app/queries/decidim/last_activity.rb
|
1704
1707
|
- app/queries/decidim/messaging/user_conversations.rb
|
1705
1708
|
- app/queries/decidim/metric_manage.rb
|
1706
1709
|
- app/queries/decidim/metric_measure.rb
|
@@ -1825,6 +1828,7 @@ files:
|
|
1825
1828
|
- app/views/decidim/devise/passwords/edit.html.erb
|
1826
1829
|
- app/views/decidim/devise/passwords/new.html.erb
|
1827
1830
|
- app/views/decidim/devise/registrations/new.html.erb
|
1831
|
+
- app/views/decidim/devise/registrations/new.html.erb.orig
|
1828
1832
|
- app/views/decidim/devise/sessions/new.html.erb
|
1829
1833
|
- app/views/decidim/devise/shared/_links.html.erb
|
1830
1834
|
- app/views/decidim/devise/shared/_newsletter_modal.html.erb
|
@@ -1853,8 +1857,10 @@ files:
|
|
1853
1857
|
- app/views/decidim/last_activities/_activities.html.erb
|
1854
1858
|
- app/views/decidim/last_activities/index.html.erb
|
1855
1859
|
- app/views/decidim/last_activities/index.js.erb
|
1860
|
+
- app/views/decidim/links/_invalid_url_modal.html.erb
|
1856
1861
|
- app/views/decidim/links/_modal.html.erb
|
1857
1862
|
- app/views/decidim/links/_warning.html.erb
|
1863
|
+
- app/views/decidim/links/invalid_url.js.erb
|
1858
1864
|
- app/views/decidim/links/new.html.erb
|
1859
1865
|
- app/views/decidim/links/new.js.erb
|
1860
1866
|
- app/views/decidim/manifests/show.json.erb
|
@@ -1995,6 +2001,7 @@ files:
|
|
1995
2001
|
- app/views/layouts/decidim/widget.html.erb
|
1996
2002
|
- config/assets.rb
|
1997
2003
|
- config/brakeman.ignore
|
2004
|
+
- config/environment.rb
|
1998
2005
|
- config/initializers/active_support.rb
|
1999
2006
|
- config/initializers/browser.rb
|
2000
2007
|
- config/initializers/carrierwave.rb
|
@@ -2025,6 +2032,7 @@ files:
|
|
2025
2032
|
- config/locales/et-EE.yml
|
2026
2033
|
- config/locales/et.yml
|
2027
2034
|
- config/locales/eu.yml
|
2035
|
+
- config/locales/fa-IR.yml
|
2028
2036
|
- config/locales/fi-pl.yml
|
2029
2037
|
- config/locales/fi-plain.yml
|
2030
2038
|
- config/locales/fi.yml
|
@@ -2043,6 +2051,7 @@ files:
|
|
2043
2051
|
- config/locales/it.yml
|
2044
2052
|
- config/locales/ja.yml
|
2045
2053
|
- config/locales/ka-GE.yml
|
2054
|
+
- config/locales/kaa.yml
|
2046
2055
|
- config/locales/ko-KR.yml
|
2047
2056
|
- config/locales/ko.yml
|
2048
2057
|
- config/locales/lb-LU.yml
|
@@ -2452,6 +2461,7 @@ files:
|
|
2452
2461
|
- lib/decidim/core/test/shared_examples/controller_render_views.rb
|
2453
2462
|
- lib/decidim/core/test/shared_examples/conversations_examples.rb
|
2454
2463
|
- lib/decidim/core/test/shared_examples/counts_commentators_as_newsletter_participants.rb
|
2464
|
+
- lib/decidim/core/test/shared_examples/digest_mail_examples.rb
|
2455
2465
|
- lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
|
2456
2466
|
- lib/decidim/core/test/shared_examples/editor_shared_examples.rb
|
2457
2467
|
- lib/decidim/core/test/shared_examples/embed_resource_examples.rb
|
@@ -2680,11 +2690,12 @@ files:
|
|
2680
2690
|
- lib/tasks/decidim_webpacker_tasks.rake
|
2681
2691
|
- lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake
|
2682
2692
|
- lib/tasks/upgrade/decidim_moderation_tasks.rake
|
2693
|
+
- lib/tasks/upgrade/decidim_user_moderation.rake
|
2683
2694
|
homepage: https://github.com/decidim/decidim
|
2684
2695
|
licenses:
|
2685
2696
|
- AGPL-3.0
|
2686
2697
|
metadata: {}
|
2687
|
-
post_install_message:
|
2698
|
+
post_install_message:
|
2688
2699
|
rdoc_options: []
|
2689
2700
|
require_paths:
|
2690
2701
|
- lib
|
@@ -2699,8 +2710,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
2699
2710
|
- !ruby/object:Gem::Version
|
2700
2711
|
version: '0'
|
2701
2712
|
requirements: []
|
2702
|
-
rubygems_version: 3.
|
2703
|
-
signing_key:
|
2713
|
+
rubygems_version: 3.2.22
|
2714
|
+
signing_key:
|
2704
2715
|
specification_version: 4
|
2705
2716
|
summary: The core of the Decidim framework.
|
2706
2717
|
test_files: []
|