decidim-cdtb 0.1.7 → 0.1.8
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 +4 -0
- data/Gemfile.lock +1 -1
- data/lib/decidim/cdtb/spam/user_spam_detector.rb +4 -2
- data/lib/decidim/cdtb/users/remover.rb +15 -0
- data/lib/decidim/cdtb/version.rb +1 -1
- 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: 7d7f9bf148f8840d5c1a477beeaff15fc28202a1ed2ec1362f7d4ce877a7b7ba
|
|
4
|
+
data.tar.gz: f24fc484d095684afffeacb808370927bbf4d7653da349cf8c036ecbad1c2f62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afdcf2aaf7ec1b44c41035d6953c9fc2c1b5d025f4e4f0632e2dc8f54d61a16da866b3060a6d77c2ad0d6e86aa432815e202123a705a48492fcd93bc487698a1
|
|
7
|
+
data.tar.gz: 00141eb4d4e782c16ef0f6f17e1a7be55e029f6ec1d29e6c957a4cedd5c4f7dead2f5ba96491b447955f41f5fdf9e69aa83ce6f4d6119735b9d5adc91b6c8afa
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.1.8] - 2024-04-24 (Sapastre i bonastre)
|
|
4
|
+
|
|
5
|
+
- Fix spam users detector with deleted_at param and hide comments in remover users.
|
|
6
|
+
|
|
3
7
|
## [0.1.7] - 2024-04-22 (Emocions de colors)
|
|
4
8
|
|
|
5
9
|
- Fix remove users task and add the reporter user mailer to arguments
|
data/Gemfile.lock
CHANGED
|
@@ -21,10 +21,12 @@ module Decidim
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def prepare_execution(_ctx)
|
|
24
|
+
base_query = Decidim::User.where(deleted_at: nil)
|
|
25
|
+
|
|
24
26
|
@users = if @organization.present?
|
|
25
|
-
|
|
27
|
+
base_query.where(organization: @organization)
|
|
26
28
|
else
|
|
27
|
-
|
|
29
|
+
base_query
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
@num_users = @users.count
|
|
@@ -5,6 +5,7 @@ module Decidim
|
|
|
5
5
|
module Users
|
|
6
6
|
# Remove Decidim::User's
|
|
7
7
|
#
|
|
8
|
+
# rubocop:disable Metrics/ClassLength
|
|
8
9
|
class Remover < ::Decidim::Cdtb::Task
|
|
9
10
|
def initialize(csv_path, reporter_user_email)
|
|
10
11
|
@csv_path = csv_path
|
|
@@ -44,6 +45,7 @@ module Decidim
|
|
|
44
45
|
def manage_comments(comments, user, reporter_user)
|
|
45
46
|
comments.find_each do |comment|
|
|
46
47
|
report_comment(comment, user, reporter_user)
|
|
48
|
+
hide_comment(comment, user, reporter_user) unless comment.hidden?
|
|
47
49
|
end
|
|
48
50
|
end
|
|
49
51
|
|
|
@@ -111,6 +113,18 @@ module Decidim
|
|
|
111
113
|
end
|
|
112
114
|
end
|
|
113
115
|
|
|
116
|
+
def hide_comment(comment, user, reporter_user)
|
|
117
|
+
Admin::HideResource.call(comment, reporter_user) do
|
|
118
|
+
on(:ok) do
|
|
119
|
+
puts "OK: Comment #{comment.id} of User #{user.id} hided"
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
on(:invalid) do
|
|
123
|
+
puts "ERROR: Comment #{comment.id} of User #{user.id} not hided"
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
114
128
|
def context_for_report(user, comment, reporter_user)
|
|
115
129
|
{
|
|
116
130
|
current_organization: user.organization,
|
|
@@ -120,6 +134,7 @@ module Decidim
|
|
|
120
134
|
}
|
|
121
135
|
end
|
|
122
136
|
end
|
|
137
|
+
# rubocop:enable Metrics/ClassLength
|
|
123
138
|
end
|
|
124
139
|
end
|
|
125
140
|
end
|
data/lib/decidim/cdtb/version.rb
CHANGED
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.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oliver Valls
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-04-
|
|
11
|
+
date: 2024-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: decidim
|