decidim-core 0.28.3 → 0.28.4
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/content_blocks/stats_cell.rb +1 -1
- data/app/cells/decidim/endorsement_buttons_cell.rb +1 -1
- data/app/cells/decidim/nav_links/show.erb +3 -3
- data/app/cells/decidim/resource_types_filter/show.erb +11 -12
- data/app/commands/decidim/amendable/create_draft.rb +1 -0
- data/app/controllers/concerns/decidim/devise_authentication_methods.rb +1 -1
- data/app/controllers/concerns/decidim/direct_upload.rb +82 -0
- data/app/forms/decidim/upload_validation_form.rb +1 -1
- data/app/helpers/decidim/layout_helper.rb +28 -0
- data/app/helpers/decidim/menu_helper.rb +1 -1
- data/app/helpers/decidim/scopes_helper.rb +5 -2
- data/app/models/decidim/action_log.rb +11 -1
- data/app/packs/src/decidim/a11y.js +11 -15
- data/app/packs/src/decidim/append_redirect_url_to_modals.js +14 -12
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +3 -0
- data/app/packs/stylesheets/decidim/_buttons.scss +1 -1
- data/app/packs/stylesheets/decidim/_modal_update.scss +4 -0
- data/app/presenters/decidim/menu_item_presenter.rb +1 -1
- data/app/queries/decidim/last_activity.rb +16 -5
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +1 -1
- data/app/views/decidim/offline/show.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +3 -3
- data/app/views/decidim/shared/_filters.html.erb +5 -5
- data/app/views/decidim/shared/_orders.html.erb +3 -2
- data/app/views/decidim/shared/filters/_check_boxes_tree.html.erb +1 -1
- data/app/views/decidim/shared/filters/_collection.html.erb +1 -1
- data/app/views/layouts/decidim/_head.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_user_profile.html.erb +2 -2
- data/config/locales/ar.yml +0 -1
- data/config/locales/bg.yml +0 -1
- data/config/locales/ca.yml +1 -1
- data/config/locales/cs.yml +1 -1
- data/config/locales/de.yml +2 -2
- data/config/locales/el.yml +0 -1
- data/config/locales/en.yml +1 -1
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/es-PY.yml +1 -1
- data/config/locales/es.yml +1 -1
- data/config/locales/eu.yml +4 -4
- data/config/locales/fi-plain.yml +1 -1
- data/config/locales/fi.yml +1 -1
- data/config/locales/fr-CA.yml +1 -1
- data/config/locales/fr.yml +1 -1
- data/config/locales/gl.yml +0 -1
- data/config/locales/hu.yml +0 -1
- data/config/locales/ja.yml +3 -3
- data/config/locales/lt.yml +0 -1
- data/config/locales/pl.yml +0 -1
- data/config/locales/pt-BR.yml +199 -1
- data/config/locales/ro-RO.yml +61 -48
- data/config/locales/sv.yml +446 -75
- data/config/locales/zh-TW.yml +0 -1
- data/lib/decidim/core/engine.rb +6 -0
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +10 -0
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +112 -14
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +11 -0
- data/lib/decidim/organization_settings.rb +4 -1
- data/lib/decidim/view_model.rb +1 -1
- data/lib/tasks/upgrade/decidim_attachments.rake +14 -0
- metadata +8 -6
data/config/locales/zh-TW.yml
CHANGED
data/lib/decidim/core/engine.rb
CHANGED
@@ -275,6 +275,12 @@ module Decidim
|
|
275
275
|
app.config.exceptions_app = Decidim::Core::Engine.routes
|
276
276
|
end
|
277
277
|
|
278
|
+
initializer "decidim_core.direct_uploader_paths", after: "decidim_core.exceptions_app" do |_app|
|
279
|
+
config.to_prepare do
|
280
|
+
ActiveStorage::DirectUploadsController.include Decidim::DirectUpload
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
278
284
|
initializer "decidim_core.locales" do |app|
|
279
285
|
app.config.i18n.fallbacks = true
|
280
286
|
end
|
@@ -494,6 +494,16 @@ shared_examples "comments" do
|
|
494
494
|
expect(page).to have_selector("span.comments-count", text: "#{commentable.comments.count} comments")
|
495
495
|
expect(page.find("#add-comment-#{commentable.commentable_type.demodulize}-#{commentable.id}").value).to be_empty
|
496
496
|
end
|
497
|
+
|
498
|
+
it "shows the entry in last activities" do
|
499
|
+
visit decidim.last_activities_path
|
500
|
+
expect(page).to have_content("New comment: #{content}")
|
501
|
+
|
502
|
+
within "#filters" do
|
503
|
+
find("a", class: "filter", text: "Comment", match: :first).click
|
504
|
+
end
|
505
|
+
expect(page).to have_content("New comment: #{content}")
|
506
|
+
end
|
497
507
|
end
|
498
508
|
|
499
509
|
context "when user adds a new comment with a link" do
|
@@ -25,7 +25,7 @@ shared_examples "Endorse resource system specs" do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
context "when endorsements are not enabled" do
|
28
|
-
let(:component_traits) { [:
|
28
|
+
let(:component_traits) { [:with_endorsements_disabled] }
|
29
29
|
|
30
30
|
context "when the user is not logged in" do
|
31
31
|
it "does not show the endorse resource button and counts" do
|
@@ -51,18 +51,18 @@ shared_examples "Endorse resource system specs" do
|
|
51
51
|
|
52
52
|
it "shows the endorsements count and the endorse button is disabled" do
|
53
53
|
visit_resource
|
54
|
-
expect(page).to have_css("
|
54
|
+
expect(page).to have_css("#resource-#{resource.id}-endorsement-block button[disabled='true']")
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
context "when endorsements are enabled" do
|
59
|
-
let(:component_traits) { [:
|
59
|
+
let(:component_traits) { [:with_endorsements_enabled] }
|
60
60
|
|
61
61
|
context "when the user is not logged in" do
|
62
62
|
it "is given the option to sign in" do
|
63
63
|
visit_resource
|
64
|
-
within "
|
65
|
-
|
64
|
+
within "#resource-#{resource.id}-endorsement-block" do
|
65
|
+
click_on "Like"
|
66
66
|
end
|
67
67
|
|
68
68
|
expect(page).to have_css("#loginModal", visible: :visible)
|
@@ -77,8 +77,8 @@ shared_examples "Endorse resource system specs" do
|
|
77
77
|
context "when the resource is not endorsed yet" do
|
78
78
|
it "is able to endorse the resource" do
|
79
79
|
visit_resource
|
80
|
-
within "
|
81
|
-
|
80
|
+
within "#resource-#{resource.id}-endorsement-block" do
|
81
|
+
click_on "Like"
|
82
82
|
expect(page).to have_button("Dislike")
|
83
83
|
end
|
84
84
|
end
|
@@ -89,7 +89,7 @@ shared_examples "Endorse resource system specs" do
|
|
89
89
|
|
90
90
|
it "is not able to endorse it again" do
|
91
91
|
visit_resource
|
92
|
-
within "
|
92
|
+
within "#resource-#{resource.id}-endorsement-block" do
|
93
93
|
expect(page).to have_button("Dislike")
|
94
94
|
expect(page).not_to have_button("Like")
|
95
95
|
end
|
@@ -97,8 +97,8 @@ shared_examples "Endorse resource system specs" do
|
|
97
97
|
|
98
98
|
it "is able to undo the endorsement" do
|
99
99
|
visit_resource
|
100
|
-
within "
|
101
|
-
|
100
|
+
within "#resource-#{resource.id}-endorsement-block" do
|
101
|
+
click_on "Dislike"
|
102
102
|
expect(page).to have_button("Like")
|
103
103
|
end
|
104
104
|
end
|
@@ -124,8 +124,8 @@ shared_examples "Endorse resource system specs" do
|
|
124
124
|
context "when user is NOT verified" do
|
125
125
|
it "is NOT able to endorse" do
|
126
126
|
visit_resource
|
127
|
-
within "
|
128
|
-
|
127
|
+
within "#resource-#{resource.id}-endorsement-block" do
|
128
|
+
click_on "Like"
|
129
129
|
end
|
130
130
|
expect(page).to have_css("#authorizationModal", visible: :visible)
|
131
131
|
end
|
@@ -142,13 +142,111 @@ shared_examples "Endorse resource system specs" do
|
|
142
142
|
|
143
143
|
it "IS able to endorse", :slow do
|
144
144
|
visit_resource
|
145
|
-
within "
|
146
|
-
|
145
|
+
within "#resource-#{resource.id}-endorsement-block" do
|
146
|
+
click_on "Like"
|
147
147
|
end
|
148
148
|
expect(page).to have_button("Dislike")
|
149
149
|
end
|
150
150
|
end
|
151
151
|
end
|
152
|
+
|
153
|
+
context "when user being a part of a group" do
|
154
|
+
let(:component_traits) { [:with_endorsements_enabled] }
|
155
|
+
let!(:user_group) do
|
156
|
+
create(
|
157
|
+
:user_group,
|
158
|
+
:verified,
|
159
|
+
name: "Tester's Organization",
|
160
|
+
nickname: "test_org",
|
161
|
+
email: "t.mail.org@example.org",
|
162
|
+
users: [user],
|
163
|
+
organization:
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
167
|
+
before do
|
168
|
+
organization.update(user_groups_enabled:)
|
169
|
+
login_as user, scope: :user
|
170
|
+
visit_resource
|
171
|
+
end
|
172
|
+
|
173
|
+
context "when organization is not allowing user groups" do
|
174
|
+
let(:user_groups_enabled) { false }
|
175
|
+
|
176
|
+
it "is able to endorse the resource" do
|
177
|
+
within "#resource-#{resource.id}-endorsement-block" do
|
178
|
+
click_on "Like"
|
179
|
+
expect(page).to have_button("Dislike")
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
context "when organization allows user groups" do
|
185
|
+
let(:user_groups_enabled) { true }
|
186
|
+
|
187
|
+
it "opens a modal where you select identity as a user or a group" do
|
188
|
+
click_on "Like"
|
189
|
+
expect(page).to have_content("Select identity")
|
190
|
+
expect(page).to have_content("Tester's Organization")
|
191
|
+
expect(page).to have_content(user.name)
|
192
|
+
end
|
193
|
+
|
194
|
+
def add_likes
|
195
|
+
click_on "Like"
|
196
|
+
within "#user-identities" do
|
197
|
+
click_on "Tester's Organization"
|
198
|
+
click_on user.name
|
199
|
+
click_on "Done"
|
200
|
+
end
|
201
|
+
visit_resource
|
202
|
+
click_on "Dislike"
|
203
|
+
end
|
204
|
+
|
205
|
+
context "when both identities picked" do
|
206
|
+
it "likes the post as a group and a user" do
|
207
|
+
add_likes
|
208
|
+
|
209
|
+
within ".identities-modal__list" do
|
210
|
+
expect(page).to have_css(".is-selected", count: 2)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
context "when like cancelled as a user" do
|
216
|
+
it "does not cancel group like" do
|
217
|
+
add_likes
|
218
|
+
find(".is-selected", match: :first).click
|
219
|
+
click_on "Done"
|
220
|
+
visit current_path
|
221
|
+
click_on "Like"
|
222
|
+
|
223
|
+
within ".identities-modal__list" do
|
224
|
+
expect(page).to have_css(".is-selected", count: 1)
|
225
|
+
within ".is-selected" do
|
226
|
+
expect(page).to have_content("Tester's Organization")
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
context "when like cancelled as a group" do
|
233
|
+
it "does not cancel user like" do
|
234
|
+
add_likes
|
235
|
+
page.all(".is-selected")[1].click
|
236
|
+
click_on "Done"
|
237
|
+
visit current_path
|
238
|
+
click_on "Dislike"
|
239
|
+
|
240
|
+
within ".identities-modal__list" do
|
241
|
+
expect(page).to have_css(".is-selected", count: 1)
|
242
|
+
within ".is-selected" do
|
243
|
+
expect(page).to have_text(user.name, exact: true)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
152
250
|
end
|
153
251
|
end
|
154
252
|
end
|
data/lib/decidim/core/version.rb
CHANGED
data/lib/decidim/core.rb
CHANGED
@@ -542,6 +542,17 @@ module Decidim
|
|
542
542
|
"/"
|
543
543
|
end
|
544
544
|
|
545
|
+
# This is the maximum time that the cache will be stored. If nil, the cache will be stored indefinitely.
|
546
|
+
# Currently, cache is applied in the Cells where the method `cache_hash` is defined.
|
547
|
+
config_accessor :cache_expiry_time do
|
548
|
+
24.hours
|
549
|
+
end
|
550
|
+
|
551
|
+
# Same as before, but specifically for cell displaying stats
|
552
|
+
config_accessor :stats_cache_expiry_time do
|
553
|
+
10.minutes
|
554
|
+
end
|
555
|
+
|
545
556
|
# Enable/Disable the service worker
|
546
557
|
config_accessor :service_worker_enabled do
|
547
558
|
Rails.env.exclude?("development")
|
@@ -105,7 +105,7 @@ module Decidim
|
|
105
105
|
"upload" => {
|
106
106
|
"allowed_file_extensions" => {
|
107
107
|
"default" => %w(jpg jpeg png pdf rtf txt),
|
108
|
-
"admin" => %w(jpg jpeg png pdf doc docx xls xlsx ppt pptx ppx rtf txt odt ott odf otg ods ots),
|
108
|
+
"admin" => %w(jpg jpeg png pdf doc docx xls xlsx ppt pptx ppx rtf txt odt ott odf otg ods ots csv json md),
|
109
109
|
"image" => %w(jpg jpeg png)
|
110
110
|
},
|
111
111
|
"allowed_content_types" => {
|
@@ -125,7 +125,10 @@ module Decidim
|
|
125
125
|
application/vnd.oasis.opendocument
|
126
126
|
application/pdf
|
127
127
|
application/rtf
|
128
|
+
application/json
|
129
|
+
text/markdown
|
128
130
|
text/plain
|
131
|
+
text/csv
|
129
132
|
)
|
130
133
|
},
|
131
134
|
"maximum_file_size" => {
|
data/lib/decidim/view_model.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :decidim do
|
4
|
+
namespace :upgrade do
|
5
|
+
desc "Cleanup the orphaned blobs attachments"
|
6
|
+
task :attachments_cleanup, [:clean_up_unattached_blobs_after_in_minutes] => :environment do |_task, args|
|
7
|
+
args.with_defaults(clean_up_unattached_blobs_after_in_minutes: 60)
|
8
|
+
|
9
|
+
clean_up_unattached_blobs_after_in_minutes = args[:clean_up_unattached_blobs_after_in_minutes].to_i
|
10
|
+
|
11
|
+
ActiveStorage::Blob.unattached.where(created_at: ..clean_up_unattached_blobs_after_in_minutes.minutes.ago).find_each(batch_size: 100, &:purge_later)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.28.
|
4
|
+
version: 0.28.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-10-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: active_link_to
|
@@ -750,28 +750,28 @@ dependencies:
|
|
750
750
|
requirements:
|
751
751
|
- - '='
|
752
752
|
- !ruby/object:Gem::Version
|
753
|
-
version: 0.28.
|
753
|
+
version: 0.28.4
|
754
754
|
type: :development
|
755
755
|
prerelease: false
|
756
756
|
version_requirements: !ruby/object:Gem::Requirement
|
757
757
|
requirements:
|
758
758
|
- - '='
|
759
759
|
- !ruby/object:Gem::Version
|
760
|
-
version: 0.28.
|
760
|
+
version: 0.28.4
|
761
761
|
- !ruby/object:Gem::Dependency
|
762
762
|
name: decidim-dev
|
763
763
|
requirement: !ruby/object:Gem::Requirement
|
764
764
|
requirements:
|
765
765
|
- - '='
|
766
766
|
- !ruby/object:Gem::Version
|
767
|
-
version: 0.28.
|
767
|
+
version: 0.28.4
|
768
768
|
type: :development
|
769
769
|
prerelease: false
|
770
770
|
version_requirements: !ruby/object:Gem::Requirement
|
771
771
|
requirements:
|
772
772
|
- - '='
|
773
773
|
- !ruby/object:Gem::Version
|
774
|
-
version: 0.28.
|
774
|
+
version: 0.28.4
|
775
775
|
description: Adds core features so other engines can hook into the framework.
|
776
776
|
email:
|
777
777
|
- josepjaume@gmail.com
|
@@ -1162,6 +1162,7 @@ files:
|
|
1162
1162
|
- app/controllers/concerns/decidim/amendments_controller.rb
|
1163
1163
|
- app/controllers/concerns/decidim/devise_authentication_methods.rb
|
1164
1164
|
- app/controllers/concerns/decidim/devise_controllers.rb
|
1165
|
+
- app/controllers/concerns/decidim/direct_upload.rb
|
1165
1166
|
- app/controllers/concerns/decidim/disable_redirection_to_external_host.rb
|
1166
1167
|
- app/controllers/concerns/decidim/filter_resource.rb
|
1167
1168
|
- app/controllers/concerns/decidim/flaggable.rb
|
@@ -2840,6 +2841,7 @@ files:
|
|
2840
2841
|
- lib/tasks/decidim_robots.rake
|
2841
2842
|
- lib/tasks/decidim_tasks.rake
|
2842
2843
|
- lib/tasks/decidim_webpacker_tasks.rake
|
2844
|
+
- lib/tasks/upgrade/decidim_attachments.rake
|
2843
2845
|
- lib/tasks/upgrade/decidim_deduplicate_endorsements.rake
|
2844
2846
|
- lib/tasks/upgrade/decidim_fix_categorization.rake
|
2845
2847
|
- lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake
|