Class: Users::AllowPossibleSpamService

Inherits:
BaseService show all
Defined in:
app/services/users/allow_possible_spam_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(current_user) ⇒ AllowPossibleSpamService

Returns a new instance of AllowPossibleSpamService.



5
6
7
# File 'app/services/users/allow_possible_spam_service.rb', line 5

def initialize(current_user)
  @current_user = current_user
end

Instance Method Details

#execute(user) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/services/users/allow_possible_spam_service.rb', line 9

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