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

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

module WorkItems
  module Widgets
    module StartAndDueDateService
      class UpdateService < WorkItems::Widgets::BaseService
        def before_update_callback(params: {})
          return widget.work_item.assign_attributes({ start_date: nil, due_date: nil }) if new_type_excludes_widget?

          return if params.blank?
          return unless has_permission?(:set_work_item_metadata)

          widget.work_item.assign_attributes(params.slice(:start_date, :due_date))
        end
      end
    end
  end
end