decidim-cdtb 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ea237b7898bc194b0f63514d1f699d5cd1cf649ac7dd7433de19d9319541474
4
- data.tar.gz: be9a6f3251d35022b933524b3227edac2186a1c338a4025f6d73eb5495633e61
3
+ metadata.gz: 7d7f9bf148f8840d5c1a477beeaff15fc28202a1ed2ec1362f7d4ce877a7b7ba
4
+ data.tar.gz: f24fc484d095684afffeacb808370927bbf4d7653da349cf8c036ecbad1c2f62
5
5
  SHA512:
6
- metadata.gz: 3999c77a44817f3c0b3bc6b97663a47f3dade93f896958cdce06298bd9695d734cdd82859315607ecc3fcd990efd6e567e2e63d6e0141f5c3d256bc44d6b91ef
7
- data.tar.gz: 513123ffe284a654f47666d8a0e355b29cb3dd011a30bab73cdef0348776f45cd44dab8c8c9f23f5e962fb5f00a5dc9acb9d68a70ced7b39335cfc225ce56839
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- decidim-cdtb (0.1.7)
4
+ decidim-cdtb (0.1.8)
5
5
  decidim (>= 0.26.2)
6
6
  rails (>= 6)
7
7
  ruby-progressbar
@@ -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
- Decidim::User.where(organization: @organization)
27
+ base_query.where(organization: @organization)
26
28
  else
27
- Decidim::User.all
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Cdtb
5
- VERSION = "0.1.7"
5
+ VERSION = "0.1.8"
6
6
  DECIDIM_MIN_VERSION = ">= 0.26.2"
7
7
  end
8
8
  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.1.7
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-22 00:00:00.000000000 Z
11
+ date: 2024-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim