decidim-cdtb 0.4.0 → 0.4.2
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/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +16 -1
- data/lib/decidim/cdtb/users/remover.rb +9 -5
- data/lib/decidim/cdtb/version.rb +1 -1
- data/lib/decidim/cdtb.rb +2 -0
- data/lib/tasks/users.rake +31 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4341e4535e244e11f06f3e3454ff7ab9654a39946a0d1b2f706820cc0f10abe9
|
4
|
+
data.tar.gz: 819ad70dea665494e389aac694e9591fab463a485215b76efb28df255800585c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c4e229cd063bc8e6dcdae11d7bcd1463c7c1f1f827e3053de05f821e31b038d41d21833505d30e78c105625d55290e297c55332085ac756adaf36edc21c246a
|
7
|
+
data.tar.gz: 15de2cc51a4bb5f2da4289742e64f8f34a78aaa145f9db29cf8fed94bee1292cf85f318a930702c6970a96da49494022cdfbe65fa0acf8a90969e4f1c798dae4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.4.2] - 2025-04-23 (minor - Sant Jordi)
|
4
|
+
|
5
|
+
- Add task to export the list of admins.
|
6
|
+
|
7
|
+
## [0.4.1] - 2025-02-10 (patch - Afamada i enfadada)
|
8
|
+
|
9
|
+
- Fix error in disabling/enabling emails on remove users task
|
10
|
+
|
3
11
|
## [0.4.0] - 2025-02-10 (minor - Llefiscós però deliciós)
|
4
12
|
|
5
13
|
- Add task to move images to hero content block in participatory spaces
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -221,11 +221,26 @@ bundle exec rake cdtb:participatory_spaces:add_content_blocks[['extra_data relat
|
|
221
221
|
|
222
222
|
```
|
223
223
|
|
224
|
+
##### Usually executed when upgrading to Decidim 0.28
|
225
|
+
|
226
|
+
To add extra_data and related_documents to content blocks in participatory spaces
|
227
|
+
|
228
|
+
```
|
229
|
+
bundle exec rake cdtb:participatory_spaces:add_content_blocks[extra_data]
|
230
|
+
bundle exec rake cdtb:participatory_spaces:add_content_blocks[related_documents]
|
231
|
+
```
|
232
|
+
|
233
|
+
To move images to a new content block in participatory spaces
|
234
|
+
|
235
|
+
```
|
236
|
+
bundle exec rake cdtb:participatory_spaces:move_images_to_content_block
|
237
|
+
```
|
238
|
+
|
224
239
|
#### Move banner images to hero content block
|
225
240
|
|
226
241
|
In previous versions of Decidim (0.27 and previous) banner images are in participatory space configuration. Now, this image is in a content block but for old spaces are in configuration yet.
|
227
242
|
|
228
|
-
This task
|
243
|
+
This task moves the banner image to a hero content block.
|
229
244
|
|
230
245
|
Spaces supported:
|
231
246
|
|
@@ -24,9 +24,9 @@ module Decidim
|
|
24
24
|
def do_execution(context)
|
25
25
|
progress_bar = context[:progress_bar]
|
26
26
|
|
27
|
-
|
27
|
+
emails_on_moderations = Decidim::User.where(email_on_moderations: true).pluck(:email)
|
28
28
|
|
29
|
-
disable_email_moderations(
|
29
|
+
disable_email_moderations(emails_on_moderations)
|
30
30
|
|
31
31
|
CSV.foreach(@csv_path, headers: true, col_sep: ",") do |row|
|
32
32
|
user = Decidim::User.find_by(id: row[0])
|
@@ -40,7 +40,7 @@ module Decidim
|
|
40
40
|
progress_bar.increment
|
41
41
|
end
|
42
42
|
ensure
|
43
|
-
enable_email_moderations(
|
43
|
+
enable_email_moderations(emails_on_moderations)
|
44
44
|
end
|
45
45
|
# rubocop:enable Metrics/AbcSize
|
46
46
|
|
@@ -50,18 +50,22 @@ module Decidim
|
|
50
50
|
|
51
51
|
private
|
52
52
|
|
53
|
-
def disable_email_moderations(
|
53
|
+
def disable_email_moderations(users_emails)
|
54
54
|
log_task_step("Disabling email on moderations...")
|
55
55
|
|
56
|
+
users = Decidim::User.where(email: users_emails)
|
57
|
+
|
56
58
|
users.find_each do |user|
|
57
59
|
user.email_on_moderations = false
|
58
60
|
user.save(validate: false)
|
59
61
|
end
|
60
62
|
end
|
61
63
|
|
62
|
-
def enable_email_moderations(
|
64
|
+
def enable_email_moderations(users_emails)
|
63
65
|
log_task_step("Enabling email on moderations...")
|
64
66
|
|
67
|
+
users = Decidim::User.where(email: users_emails)
|
68
|
+
|
65
69
|
users.find_each do |user|
|
66
70
|
user.email_on_moderations = true
|
67
71
|
user.save(validate: false)
|
data/lib/decidim/cdtb/version.rb
CHANGED
data/lib/decidim/cdtb.rb
CHANGED
data/lib/tasks/users.rake
CHANGED
@@ -19,5 +19,36 @@ namespace :cdtb do
|
|
19
19
|
service = ::Decidim::Cdtb::Users::Remover.new(args.csv_path, args.reporter_user_email)
|
20
20
|
service.execute!
|
21
21
|
end
|
22
|
+
|
23
|
+
desc <<~EODESC
|
24
|
+
Exports the list of admins to a CSV file. If +org_id+ is set, filters by that organization.
|
25
|
+
EODESC
|
26
|
+
task :list_admins, %i[org_id] => [:environment] do |_taks, args|
|
27
|
+
organization_id= args.org_id
|
28
|
+
|
29
|
+
query= Decidim::User.includes(:organization).where(admin: true)
|
30
|
+
filename= "admins"
|
31
|
+
|
32
|
+
if organization_id.present?
|
33
|
+
query= query.where(organization_id: organization_id)
|
34
|
+
filename+= "-org#{organization_id}"
|
35
|
+
end
|
36
|
+
|
37
|
+
CSV.open("#{filename}.csv", "wb") do |csv|
|
38
|
+
csv << ["ID", "Organization ID", "Organization", "Name", "Email", "Created at", "Last sign in at"]
|
39
|
+
|
40
|
+
query.find_each do |admin|
|
41
|
+
csv << [
|
42
|
+
admin.id,
|
43
|
+
admin.organization.id,
|
44
|
+
admin.organization.name,
|
45
|
+
admin.name,
|
46
|
+
admin.email,
|
47
|
+
admin.created_at.strftime(Decidim::Cdtb::STRFTIME_FORMAT),
|
48
|
+
admin.last_sign_in_at&.strftime(Decidim::Cdtb::STRFTIME_FORMAT)
|
49
|
+
]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
22
53
|
end
|
23
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-cdtb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Valls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim
|