Class: Issuable::Callbacks::Description

Inherits:
Base
  • Object
show all
Defined in:
app/services/issuable/callbacks/description.rb

Constant Summary collapse

ALLOWED_PARAMS =
%i[description].freeze

Constants inherited from Base

Base::Error

Instance Method Summary collapse

Methods inherited from Base

#after_create, #after_save, #after_save_commit, #after_update, #after_update_commit, #before_create, execute_without_params?, #initialize

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

This class inherits a constructor from Issuable::Callbacks::Base

Instance Method Details

#after_initializeObject



8
9
10
11
12
13
14
# File 'app/services/issuable/callbacks/description.rb', line 8

def after_initialize
  params[:description] = nil if excluded_in_new_type?

  return unless update_description?

  issuable.description = params[:description]
end

#before_updateObject



16
17
18
19
20
21
22
# File 'app/services/issuable/callbacks/description.rb', line 16

def before_update
  return unless issuable.description_changed?

  author = Gitlab::Auth::Identity.invert_composite_identity(current_user)

  issuable.assign_attributes(last_edited_at: Time.current, last_edited_by: author)
end