decidim-core 0.7.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +9 -2
- data/app/assets/javascripts/decidim.js.es6 +1 -0
- data/app/assets/javascripts/decidim/editor.js.es6 +8 -2
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +2 -2
- data/app/assets/javascripts/decidim/foundation.js.es6 +18 -8
- data/app/assets/javascripts/decidim/select2.js.es6 +3 -0
- data/app/assets/stylesheets/decidim/_decidim.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +0 -4
- data/app/assets/stylesheets/decidim/modules/_cards.scss +41 -1
- data/app/assets/stylesheets/decidim/modules/_messages.scss +35 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +2 -1
- data/app/assets/stylesheets/decidim/utils/_settings.scss +363 -69
- data/app/commands/decidim/messaging/reply_to_conversation.rb +55 -0
- data/app/commands/decidim/messaging/start_conversation.rb +55 -0
- data/app/controllers/concerns/decidim/action_authorization.rb +6 -22
- data/app/controllers/concerns/decidim/user_profile.rb +5 -3
- data/app/controllers/decidim/application_controller.rb +1 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +2 -2
- data/app/controllers/decidim/devise/sessions_controller.rb +5 -3
- data/app/controllers/decidim/features/base_controller.rb +1 -0
- data/app/controllers/decidim/messaging/conversations_controller.rb +81 -0
- data/app/controllers/decidim/pages_controller.rb +2 -11
- data/app/forms/decidim/messaging/conversation_form.rb +19 -0
- data/app/forms/decidim/messaging/message_form.rb +14 -0
- data/app/forms/translatable_presence_validator.rb +7 -10
- data/app/helpers/decidim/authorization_form_helper.rb +1 -1
- data/app/helpers/decidim/cta_button_helper.rb +1 -1
- data/app/helpers/decidim/datetime_helper.rb +23 -0
- data/app/helpers/decidim/feature_path_helper.rb +4 -2
- data/app/helpers/decidim/layout_helper.rb +0 -2
- data/app/helpers/decidim/menu_helper.rb +10 -0
- data/app/helpers/decidim/messaging/conversation_helper.rb +36 -0
- data/app/helpers/decidim/sanitize_helper.rb +19 -0
- data/app/helpers/decidim/traceability_helper.rb +89 -0
- data/app/helpers/decidim/translations_helper.rb +4 -2
- data/app/helpers/decidim/view_hooks_helper.rb +15 -0
- data/app/jobs/decidim/email_notification_generator_job.rb +1 -1
- data/app/jobs/decidim/notification_generator_for_recipient_job.rb +1 -1
- data/app/jobs/decidim/notification_generator_job.rb +1 -1
- data/app/mailers/decidim/messaging/conversation_mailer.rb +47 -0
- data/app/mailers/decidim/newsletter_mailer.rb +1 -0
- data/app/models/decidim/abilities/base_ability.rb +16 -2
- data/app/models/decidim/authorization.rb +20 -2
- data/app/models/decidim/messaging/conversation.rb +129 -0
- data/app/models/decidim/messaging/message.rb +49 -0
- data/app/models/decidim/messaging/participation.rb +23 -0
- data/app/models/decidim/messaging/receipt.rb +27 -0
- data/app/models/decidim/moderation.rb +1 -1
- data/app/models/decidim/organization.rb +2 -2
- data/app/models/decidim/scope.rb +2 -1
- data/app/models/decidim/scope_type.rb +1 -1
- data/app/models/decidim/user.rb +11 -5
- data/app/models/decidim/user_group.rb +1 -1
- data/app/presenters/decidim/inline_menu_presenter.rb +10 -0
- data/app/presenters/decidim/menu_presenter.rb +1 -1
- data/app/queries/decidim/messaging/user_conversations.rb +29 -0
- data/app/scrubbers/decidim/user_input_scrubber.rb +31 -0
- data/app/services/decidim/action_authorizer.rb +48 -12
- data/app/services/decidim/traceability.rb +91 -0
- data/app/views/decidim/messaging/conversation_mailer/new_conversation.html.erb +9 -0
- data/app/views/decidim/messaging/conversation_mailer/new_message.html.erb +9 -0
- data/app/views/decidim/messaging/conversations/_message.html.erb +20 -0
- data/app/views/decidim/messaging/conversations/_reply.html.erb +11 -0
- data/app/views/decidim/messaging/conversations/_show.html.erb +21 -0
- data/app/views/decidim/messaging/conversations/_start.html.erb +12 -0
- data/app/views/decidim/messaging/conversations/create.js.erb +2 -0
- data/app/views/decidim/messaging/conversations/index.html.erb +51 -0
- data/app/views/decidim/messaging/conversations/new.html.erb +5 -0
- data/app/views/decidim/messaging/conversations/show.html.erb +9 -0
- data/app/views/decidim/messaging/conversations/update.js.erb +1 -0
- data/app/views/decidim/newsletter_mailer/newsletter.html.erb +1 -1
- data/app/views/decidim/notifications/_notification.html.erb +1 -1
- data/app/views/decidim/shared/_action_authorization_modal.html.erb +11 -1
- data/app/views/decidim/shared/_announcement.html.erb +1 -1
- data/app/views/decidim/shared/_version_author.html.erb +18 -0
- data/app/views/layouts/decidim/_wrapper.html.erb +3 -0
- data/app/views/layouts/decidim/user_profile.html.erb +1 -9
- data/app/views/pages/decidim_page.html.erb +1 -1
- data/app/views/pages/home.html.erb +0 -2
- data/app/views/pages/home/_footer_sub_hero.html.erb +5 -3
- data/app/views/pages/home/_hero.html.erb +1 -1
- data/app/views/pages/home/_highlighted_processes.html.erb +7 -37
- data/app/views/pages/home/_sub_hero.html.erb +6 -4
- data/config/locales/ca.yml +49 -21
- data/config/locales/en.yml +47 -19
- data/config/locales/es.yml +48 -20
- data/config/locales/eu.yml +51 -23
- data/config/locales/fi.yml +50 -22
- data/config/locales/fr.yml +50 -22
- data/config/locales/it.yml +89 -61
- data/config/locales/nl.yml +72 -44
- data/config/locales/pl.yml +49 -21
- data/config/locales/pt.yml +431 -0
- data/config/locales/ru.yml +4 -27
- data/config/locales/uk.yml +10 -23
- data/config/routes.rb +3 -5
- data/db/migrate/20170313095436_add_available_authorizations_to_organization.rb +2 -2
- data/db/migrate/20170713131308_migrate_user_roles_to_participatory_process_roles.rb +7 -3
- data/db/migrate/20170914092117_add_status_to_authorizations.rb +9 -0
- data/db/migrate/20171011194251_add_verification_metadata_to_authorizations.rb +11 -0
- data/db/migrate/20171013124505_add_verification_attachment_to_authorizations.rb +9 -0
- data/db/migrate/20171023123330_create_decidim_messaging.rb +23 -0
- data/db/migrate/20171107103253_create_versions.rb +18 -0
- data/db/migrate/20171107103254_add_object_changes_to_versions.rb +14 -0
- data/db/migrate/20171117100533_create_decidim_receipts.rb +13 -0
- data/db/seeds.rb +13 -3
- data/lib/decidim/core.rb +13 -6
- data/lib/decidim/core/engine.rb +37 -0
- data/lib/decidim/core/test/factories.rb +33 -21
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/manage_moderations_examples.rb +6 -11
- data/lib/decidim/core/test/shared_examples/process_announcements_examples.rb +2 -4
- data/lib/decidim/core/test/shared_examples/reportable.rb +33 -31
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +29 -31
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/engine_router.rb +4 -2
- data/lib/decidim/has_reference.rb +10 -2
- data/lib/decidim/messaging.rb +9 -0
- data/lib/decidim/participable.rb +1 -1
- data/lib/decidim/traceable.rb +31 -0
- data/lib/decidim/view_hooks.rb +108 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.es.js +4 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.pt.js +14 -0
- metadata +179 -113
- data/app/commands/decidim/authorize_user.rb +0 -59
- data/app/controllers/decidim/authorizations_controller.rb +0 -80
- data/app/services/decidim/authorization_handler.rb +0 -95
- data/app/views/decidim/authorizations/first_login.html.erb +0 -22
- data/app/views/decidim/authorizations/index.html.erb +0 -49
- data/app/views/decidim/authorizations/new.html.erb +0 -33
@@ -3,7 +3,10 @@
|
|
3
3
|
require "decidim/faker/localized"
|
4
4
|
require "decidim/dev"
|
5
5
|
|
6
|
-
|
6
|
+
require "decidim/participatory_processes/test/factories"
|
7
|
+
require "decidim/comments/test/factories"
|
8
|
+
|
9
|
+
FactoryBot.define do
|
7
10
|
sequence(:name) do |n|
|
8
11
|
"#{Faker::Name.name} #{n}"
|
9
12
|
end
|
@@ -24,7 +27,7 @@ FactoryGirl.define do
|
|
24
27
|
"#{Faker::Lorem.characters(4).upcase}-#{n}"
|
25
28
|
end
|
26
29
|
|
27
|
-
factory :category, class: Decidim::Category do
|
30
|
+
factory :category, class: "Decidim::Category" do
|
28
31
|
name { Decidim::Faker::Localized.sentence(3) }
|
29
32
|
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(2) } }
|
30
33
|
|
@@ -37,7 +40,7 @@ FactoryGirl.define do
|
|
37
40
|
participatory_space { parent.participatory_space }
|
38
41
|
end
|
39
42
|
|
40
|
-
factory :organization, class: Decidim::Organization do
|
43
|
+
factory :organization, class: "Decidim::Organization" do
|
41
44
|
name { Faker::Company.unique.name }
|
42
45
|
reference_prefix { Faker::Name.suffix }
|
43
46
|
twitter_handler { Faker::Hipster.word }
|
@@ -57,7 +60,7 @@ FactoryGirl.define do
|
|
57
60
|
official_url { Faker::Internet.url }
|
58
61
|
end
|
59
62
|
|
60
|
-
factory :user, class: Decidim::User do
|
63
|
+
factory :user, class: "Decidim::User" do
|
61
64
|
email { generate(:email) }
|
62
65
|
password "password1234"
|
63
66
|
password_confirmation "password1234"
|
@@ -137,13 +140,13 @@ FactoryGirl.define do
|
|
137
140
|
end
|
138
141
|
end
|
139
142
|
|
140
|
-
factory :participatory_process_user_role, class: Decidim::ParticipatoryProcessUserRole do
|
143
|
+
factory :participatory_process_user_role, class: "Decidim::ParticipatoryProcessUserRole" do
|
141
144
|
user
|
142
145
|
participatory_process { create :participatory_process, organization: user.organization }
|
143
146
|
role "admin"
|
144
147
|
end
|
145
148
|
|
146
|
-
factory :user_group, class: Decidim::UserGroup do
|
149
|
+
factory :user_group, class: "Decidim::UserGroup" do
|
147
150
|
name { Faker::Educator.course }
|
148
151
|
document_number { Faker::Number.number(8) + "X" }
|
149
152
|
phone { Faker::PhoneNumber.phone_number }
|
@@ -172,25 +175,34 @@ FactoryGirl.define do
|
|
172
175
|
end
|
173
176
|
end
|
174
177
|
|
175
|
-
factory :user_group_membership, class: Decidim::UserGroupMembership do
|
178
|
+
factory :user_group_membership, class: "Decidim::UserGroupMembership" do
|
176
179
|
user
|
177
180
|
user_group
|
178
181
|
end
|
179
182
|
|
180
|
-
factory :identity, class: Decidim::Identity do
|
183
|
+
factory :identity, class: "Decidim::Identity" do
|
181
184
|
provider "facebook"
|
182
185
|
sequence(:uid)
|
183
186
|
user
|
184
187
|
organization { user.organization }
|
185
188
|
end
|
186
189
|
|
187
|
-
factory :authorization, class: Decidim::Authorization do
|
188
|
-
name "
|
190
|
+
factory :authorization, class: "Decidim::Authorization" do
|
191
|
+
sequence(:name) { |n| "dummy_authorization_#{n}" }
|
189
192
|
user
|
190
193
|
metadata { {} }
|
194
|
+
granted
|
195
|
+
|
196
|
+
trait :granted do
|
197
|
+
granted_at { 1.day.ago }
|
198
|
+
end
|
199
|
+
|
200
|
+
trait :pending do
|
201
|
+
granted_at nil
|
202
|
+
end
|
191
203
|
end
|
192
204
|
|
193
|
-
factory :static_page, class: Decidim::StaticPage do
|
205
|
+
factory :static_page, class: "Decidim::StaticPage" do
|
194
206
|
slug { generate(:slug) }
|
195
207
|
title { Decidim::Faker::Localized.sentence(3) }
|
196
208
|
content { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
|
@@ -201,7 +213,7 @@ FactoryGirl.define do
|
|
201
213
|
end
|
202
214
|
end
|
203
215
|
|
204
|
-
factory :attachment, class: Decidim::Attachment do
|
216
|
+
factory :attachment, class: "Decidim::Attachment" do
|
205
217
|
title { Decidim::Faker::Localized.sentence(3) }
|
206
218
|
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
|
207
219
|
file { Decidim::Dev.test_file("city.jpeg", "image/jpeg") }
|
@@ -216,7 +228,7 @@ FactoryGirl.define do
|
|
216
228
|
end
|
217
229
|
end
|
218
230
|
|
219
|
-
factory :feature, class: Decidim::Feature do
|
231
|
+
factory :feature, class: "Decidim::Feature" do
|
220
232
|
transient do
|
221
233
|
organization { create(:organization) }
|
222
234
|
end
|
@@ -235,13 +247,13 @@ FactoryGirl.define do
|
|
235
247
|
end
|
236
248
|
end
|
237
249
|
|
238
|
-
factory :scope_type, class: Decidim::ScopeType do
|
250
|
+
factory :scope_type, class: "Decidim::ScopeType" do
|
239
251
|
name { Decidim::Faker::Localized.word }
|
240
252
|
plural { Decidim::Faker::Localized.literal(name.values.first.pluralize) }
|
241
253
|
organization
|
242
254
|
end
|
243
255
|
|
244
|
-
factory :scope, class: Decidim::Scope do
|
256
|
+
factory :scope, class: "Decidim::Scope" do
|
245
257
|
name { Decidim::Faker::Localized.literal(generate(:scope_name)) }
|
246
258
|
code { generate(:scope_code) }
|
247
259
|
scope_type
|
@@ -256,19 +268,19 @@ FactoryGirl.define do
|
|
256
268
|
end
|
257
269
|
end
|
258
270
|
|
259
|
-
factory :dummy_resource, class: Decidim::DummyResources::DummyResource do
|
271
|
+
factory :dummy_resource, class: "Decidim::DummyResources::DummyResource" do
|
260
272
|
title { generate(:name) }
|
261
273
|
feature { create(:feature, manifest_name: "dummy") }
|
262
274
|
author { create(:user, :confirmed, organization: feature.organization) }
|
263
275
|
end
|
264
276
|
|
265
|
-
factory :resource_link, class: Decidim::ResourceLink do
|
277
|
+
factory :resource_link, class: "Decidim::ResourceLink" do
|
266
278
|
name { generate(:slug) }
|
267
279
|
to { build(:dummy_resource) }
|
268
280
|
from { build(:dummy_resource, feature: to.feature) }
|
269
281
|
end
|
270
282
|
|
271
|
-
factory :newsletter, class: Decidim::Newsletter do
|
283
|
+
factory :newsletter, class: "Decidim::Newsletter" do
|
272
284
|
author { build(:user, :confirmed, organization: organization) }
|
273
285
|
organization
|
274
286
|
|
@@ -276,18 +288,18 @@ FactoryGirl.define do
|
|
276
288
|
body { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
|
277
289
|
end
|
278
290
|
|
279
|
-
factory :moderation, class: Decidim::Moderation do
|
291
|
+
factory :moderation, class: "Decidim::Moderation" do
|
280
292
|
reportable { build(:dummy_resource) }
|
281
293
|
participatory_space { reportable.feature.participatory_space }
|
282
294
|
end
|
283
295
|
|
284
|
-
factory :report, class: Decidim::Report do
|
296
|
+
factory :report, class: "Decidim::Report" do
|
285
297
|
moderation
|
286
298
|
user { build(:user, organization: moderation.reportable.organization) }
|
287
299
|
reason "spam"
|
288
300
|
end
|
289
301
|
|
290
|
-
factory :impersonation_log, class: Decidim::ImpersonationLog do
|
302
|
+
factory :impersonation_log, class: "Decidim::ImpersonationLog" do
|
291
303
|
admin { build(:user, :admin) }
|
292
304
|
user { build(:user, :managed, organization: admin.organization) }
|
293
305
|
started_at { 10.minutes.ago }
|
@@ -26,7 +26,7 @@ shared_examples "manage moderations" do
|
|
26
26
|
it "user can review them" do
|
27
27
|
moderations.each do |moderation|
|
28
28
|
within "tr[data-id=\"#{moderation.id}\"]" do
|
29
|
-
expect(page).to
|
29
|
+
expect(page).to have_css("a[href='#{moderation.reportable.reported_content_url}']")
|
30
30
|
expect(page).to have_content "Spam"
|
31
31
|
end
|
32
32
|
end
|
@@ -34,23 +34,18 @@ shared_examples "manage moderations" do
|
|
34
34
|
|
35
35
|
it "user can un-report a resource" do
|
36
36
|
within "tr[data-id=\"#{moderation.id}\"]" do
|
37
|
-
|
37
|
+
click_link "Unreport"
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
expect(page).to have_content("Resource successfully unreported")
|
42
|
-
end
|
40
|
+
expect(page).to have_admin_callout("Resource successfully unreported")
|
43
41
|
end
|
44
42
|
|
45
43
|
it "user can hide a resource" do
|
46
44
|
within "tr[data-id=\"#{moderation.id}\"]" do
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
within ".callout-wrapper" do
|
51
|
-
expect(page).to have_content("Resource successfully hidden")
|
45
|
+
click_link "Hide"
|
52
46
|
end
|
53
47
|
|
48
|
+
expect(page).to have_admin_callout("Resource successfully hidden")
|
54
49
|
expect(page).to have_no_content(moderation.reportable.reported_content_url)
|
55
50
|
end
|
56
51
|
end
|
@@ -61,7 +56,7 @@ shared_examples "manage moderations" do
|
|
61
56
|
|
62
57
|
hidden_moderations.each do |moderation|
|
63
58
|
within "tr[data-id=\"#{moderation.id}\"]" do
|
64
|
-
expect(page).to
|
59
|
+
expect(page).to have_css("a[href='#{moderation.reportable.reported_content_url}']")
|
65
60
|
end
|
66
61
|
end
|
67
62
|
end
|
@@ -18,14 +18,12 @@ shared_examples "manage processes announcements" do
|
|
18
18
|
find("*[type=submit]").click
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
expect(page).to have_content("successfully")
|
23
|
-
end
|
21
|
+
expect(page).to have_admin_callout("successfully")
|
24
22
|
|
25
23
|
visit decidim_admin_participatory_processes.participatory_processes_path
|
26
24
|
|
27
25
|
within "tr", text: translated(participatory_process.title) do
|
28
|
-
|
26
|
+
click_link "Preview"
|
29
27
|
end
|
30
28
|
|
31
29
|
expect(page).to have_content("An important announcement")
|
@@ -3,43 +3,45 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
shared_examples_for "reportable" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
context "is reportable" do
|
7
|
+
let(:user) { create(:user, organization: subject.organization) }
|
8
|
+
let(:participatory_space) { subject.feature.participatory_space }
|
9
|
+
let(:moderation) { create(:moderation, reportable: subject, participatory_space: participatory_space, report_count: 1) }
|
10
|
+
let!(:report) { create(:report, moderation: moderation, user: user) }
|
11
|
+
|
12
|
+
describe "#reported_by?" do
|
13
|
+
context "when the resource has not been reported by the given user" do
|
14
|
+
let!(:report) { nil }
|
15
|
+
|
16
|
+
it { expect(subject.reported_by?(user)).to be_falsey }
|
17
|
+
end
|
18
|
+
|
19
|
+
context "when the resource has been reported" do
|
20
|
+
it { expect(subject.reported_by?(user)).to be_truthy }
|
21
|
+
end
|
20
22
|
end
|
21
|
-
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
context "#hidden?" do
|
25
|
+
context "when the resource has not been hidden" do
|
26
|
+
it { expect(subject).not_to be_hidden }
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
context "when the resource has been hidden" do
|
30
|
+
let(:moderation) { create(:moderation, reportable: subject, participatory_space: participatory_space, report_count: 1, hidden_at: Time.current) }
|
31
|
+
it { expect(subject).to be_hidden }
|
32
|
+
end
|
31
33
|
end
|
32
|
-
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
context "#reported?" do
|
36
|
+
context "when the report count is equal to 0" do
|
37
|
+
let(:moderation) { create(:moderation, reportable: subject, participatory_space: participatory_space, report_count: 0) }
|
38
|
+
let!(:report) { nil }
|
39
|
+
it { expect(subject).not_to be_reported }
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
context "when the report count is greater than 0" do
|
43
|
+
it { expect(subject).to be_reported }
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
@@ -3,39 +3,37 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
shared_examples "scope helpers" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
let(:organization) { create(:organization) }
|
7
|
+
let(:scopes_enabled) { true }
|
8
|
+
let(:participatory_space_scope) { nil }
|
9
|
+
let(:feature) { create(:feature, manifest_name: "dummy", participatory_space: participatory_space) }
|
10
|
+
let(:scope) { create(:scope, organization: organization) }
|
11
|
+
let(:resource) { create(:dummy_resource, feature: feature, scope: scope) }
|
12
|
+
|
13
|
+
subject { helper.has_visible_scopes?(resource) }
|
14
|
+
|
15
|
+
before do
|
16
|
+
allow(helper).to receive(:current_participatory_space).and_return(participatory_space)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "has_visible_scopes?" do
|
20
|
+
context "when all conditions are met" do
|
21
|
+
it { is_expected.to be_truthy }
|
22
|
+
end
|
23
|
+
|
24
|
+
context "when the process has not scope enabled" do
|
25
|
+
let(:scopes_enabled) { false }
|
26
|
+
it { is_expected.to be_falsey }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when the process has a scope" do
|
30
|
+
let(:participatory_space_scope) { create(:scope, organization: organization) }
|
31
|
+
it { is_expected.to be_falsey }
|
18
32
|
end
|
19
33
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
context "when the process has not scope enabled" do
|
26
|
-
let(:scopes_enabled) { false }
|
27
|
-
it { is_expected.to be_falsey }
|
28
|
-
end
|
29
|
-
|
30
|
-
context "when the process has a scope" do
|
31
|
-
let(:participatory_space_scope) { create(:scope, organization: organization) }
|
32
|
-
it { is_expected.to be_falsey }
|
33
|
-
end
|
34
|
-
|
35
|
-
context "when the resource has not a scope" do
|
36
|
-
let(:scope) { nil }
|
37
|
-
it { is_expected.to be_falsey }
|
38
|
-
end
|
34
|
+
context "when the resource has not a scope" do
|
35
|
+
let(:scope) { nil }
|
36
|
+
it { is_expected.to be_falsey }
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|
data/lib/decidim/core/version.rb
CHANGED
@@ -28,13 +28,15 @@ module Decidim
|
|
28
28
|
new(target.mounted_admin_engine, target.mounted_params)
|
29
29
|
end
|
30
30
|
|
31
|
-
attr_reader :default_url_options
|
32
|
-
|
33
31
|
def initialize(engine, default_url_options)
|
34
32
|
@engine = engine
|
35
33
|
@default_url_options = default_url_options
|
36
34
|
end
|
37
35
|
|
36
|
+
def default_url_options
|
37
|
+
@default_url_options.reverse_merge(ActionMailer::Base.default_url_options)
|
38
|
+
end
|
39
|
+
|
38
40
|
def respond_to_missing?(method_name, include_private = false)
|
39
41
|
route_helper?(method_name) || super
|
40
42
|
end
|
@@ -28,12 +28,20 @@ module Decidim
|
|
28
28
|
Decidim.resource_reference_generator.call(self, feature)
|
29
29
|
end
|
30
30
|
|
31
|
-
# Internal: Sets the unique reference to the model.
|
31
|
+
# Internal: Sets the unique reference to the model. Note that if the resource
|
32
|
+
# implements `Decidim::Traceable` then any normal update (or `update_attributes`)
|
33
|
+
# will create a new version through an ActiveRecord update callback, but here
|
34
|
+
# we can't track the author of the version, so we use the `update_column` method
|
35
|
+
# which does not trigger callbacks.
|
32
36
|
#
|
33
37
|
# Returns nothing.
|
34
38
|
def store_reference
|
35
39
|
self[:reference] ||= calculate_reference
|
36
|
-
|
40
|
+
return unless changed?
|
41
|
+
|
42
|
+
# rubocop:disable Rails/SkipsModelValidations
|
43
|
+
update_column(:reference, self[:reference])
|
44
|
+
# rubocop:enable Rails/SkipsModelValidations
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|