Class: Users::SetStatusService
- Inherits:
-
Object
- Object
- Users::SetStatusService
- Includes:
- Gitlab::Allowable
- Defined in:
- app/services/users/set_status_service.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#target_user ⇒ Object
readonly
Returns the value of attribute target_user.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, params) ⇒ SetStatusService
constructor
A new instance of SetStatusService.
Methods included from Gitlab::Allowable
Constructor Details
#initialize(current_user, params) ⇒ SetStatusService
Returns a new instance of SetStatusService.
9 10 11 12 13 |
# File 'app/services/users/set_status_service.rb', line 9 def initialize(current_user, params) @current_user = current_user @params = params.dup @target_user = params.delete(:user) || current_user end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
7 8 9 |
# File 'app/services/users/set_status_service.rb', line 7 def current_user @current_user end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
7 8 9 |
# File 'app/services/users/set_status_service.rb', line 7 def params @params end |
#target_user ⇒ Object (readonly)
Returns the value of attribute target_user.
7 8 9 |
# File 'app/services/users/set_status_service.rb', line 7 def target_user @target_user end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/services/users/set_status_service.rb', line 15 def execute return false unless can?(current_user, :update_user_status, target_user) if status_cleared? remove_status else set_status end end |