diff options
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/issuable_base_service.rb | 10 | ||||
-rw-r--r-- | app/services/slash_commands/interpret_service.rb | 7 |
2 files changed, 3 insertions, 14 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 7491c256b99..5f3ced49665 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -164,7 +164,6 @@ class IssuableBaseService < BaseService def create(issuable) merge_slash_commands_into_params!(issuable) filter_params(issuable) - change_time_spent(issuable) params.delete(:state_event) params[:author] ||= current_user @@ -207,14 +206,13 @@ class IssuableBaseService < BaseService change_subscription(issuable) change_todo(issuable) filter_params(issuable) - time_spent = change_time_spent(issuable) old_labels = issuable.labels.to_a old_mentioned_users = issuable.mentioned_users.to_a label_ids = process_label_ids(params, existing_label_ids: issuable.label_ids) params[:label_ids] = label_ids if labels_changing?(issuable.label_ids, label_ids) - if (params.present? || time_spent) && update_issuable(issuable, params) + if params.present? && update_issuable(issuable, params) # We do not touch as it will affect a update on updated_at field ActiveRecord::Base.no_touching do handle_common_system_notes(issuable, old_labels: old_labels) @@ -261,12 +259,6 @@ class IssuableBaseService < BaseService end end - def change_time_spent(issuable) - time_spent = params.delete(:spend_time) - - issuable.spend_time(time_spent, current_user) if time_spent - end - def has_changes?(issuable, old_labels: []) valid_attrs = [:title, :description, :assignee_id, :milestone_id, :target_branch] diff --git a/app/services/slash_commands/interpret_service.rb b/app/services/slash_commands/interpret_service.rb index ea00415ae1f..ab69ce91d18 100644 --- a/app/services/slash_commands/interpret_service.rb +++ b/app/services/slash_commands/interpret_service.rb @@ -262,13 +262,10 @@ module SlashCommands current_user.can?(:"admin_#{issuable.to_ability_name}", issuable) end command :spend do |raw_duration| - reduce_time = raw_duration.sub!(/\A-/, '') time_spent = Gitlab::TimeTrackingFormatter.parse(raw_duration) if time_spent - time_spent *= -1 if reduce_time - - @updates[:spend_time] = time_spent + @updates[:spend_time] = { duration: time_spent, user: current_user } end end @@ -287,7 +284,7 @@ module SlashCommands current_user.can?(:"admin_#{issuable.to_ability_name}", project) end command :remove_time_spent do - @updates[:spend_time] = :reset + @updates[:spend_time] = { duration: :reset, user: current_user } end # This is a dummy command, so that it appears in the autocomplete commands |