Commit 2bfde899 authored by Rémy Coutable's avatar Rémy Coutable

Quick fix issuable update when only time spent is updated

Since 9f97fa4d, we don't always set label_ids, meaning that we don't
call `issuable.update` is `params` are empty. The issue is that if you
only send a `/spent 5m` command, it builds an associated `timelogs`
record on the issuable that is only save when we update the issuable.

For now, we check that if we have a `spent_time`, we need to update the
issuable in order to save the associated record. This should be
improved.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 208f1f27
......@@ -189,7 +189,7 @@ class IssuableBaseService < BaseService
change_state(issuable)
change_subscription(issuable)
change_todo(issuable)
change_time_spent(issuable)
time_spent = change_time_spent(issuable)
filter_params
old_labels = issuable.labels.to_a
old_mentioned_users = issuable.mentioned_users.to_a
......@@ -197,7 +197,7 @@ class IssuableBaseService < BaseService
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? && update_issuable(issuable, params)
if (params.present? || time_spent) && 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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment