Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-21 15:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-21 15:09:17 +0300
commit0c4570435d417b69efd433057f95f01810618837 (patch)
tree4e402832206b83da2d73671977c1e5f7cae9074a /app/services/users
parent49abdb108a4d3c3f2ef9b27c7c4dcde43da1016a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/users')
-rw-r--r--app/services/users/allow_possible_spam_service.rb18
-rw-r--r--app/services/users/disallow_possible_spam_service.rb13
2 files changed, 31 insertions, 0 deletions
diff --git a/app/services/users/allow_possible_spam_service.rb b/app/services/users/allow_possible_spam_service.rb
new file mode 100644
index 00000000000..d9273fe0fc1
--- /dev/null
+++ b/app/services/users/allow_possible_spam_service.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module Users
+ class AllowPossibleSpamService < BaseService
+ def initialize(current_user)
+ @current_user = current_user
+ end
+
+ def execute(user)
+ custom_attribute = {
+ user_id: user.id,
+ key: UserCustomAttribute::ALLOW_POSSIBLE_SPAM,
+ value: "#{current_user.username}/#{current_user.id}+#{Time.current}"
+ }
+ UserCustomAttribute.upsert_custom_attributes([custom_attribute])
+ end
+ end
+end
diff --git a/app/services/users/disallow_possible_spam_service.rb b/app/services/users/disallow_possible_spam_service.rb
new file mode 100644
index 00000000000..e31ba7ddff0
--- /dev/null
+++ b/app/services/users/disallow_possible_spam_service.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module Users
+ class DisallowPossibleSpamService < BaseService
+ def initialize(current_user)
+ @current_user = current_user
+ end
+
+ def execute(user)
+ user.custom_attributes.by_key(UserCustomAttribute::ALLOW_POSSIBLE_SPAM).delete_all
+ end
+ end
+end