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

description.rb « callbacks « work_items « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b9620c652148ba95ce6a41cc4452696a3341b4d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module WorkItems
  module Callbacks
    class Description < Base
      def before_update
        params[:description] = nil if excluded_in_new_type?

        return unless params.present? && params.key?(:description)
        return unless has_permission?(:update_work_item)

        work_item.description = params[:description]
        work_item.assign_attributes(last_edited_at: Time.current, last_edited_by: current_user)
      end
    end
  end
end