Skip to content

Add system note support for updating an issue's start date

What does this MR do and why?

This change came as the result of using redis counters to track users updating dates on work items !93231 (merged). Around issues, it's a common pattern to track this user actions when system notes are created since it mean the action has actually been successful, and also makes it accessible since the date change might come from different places in the code, but we should always create the system note.

This change allows adding a single system note if start due date are changed at the same time in an Issue (start_date column recently introduced). In the future we might want to unify the change date system note behavior with other issuables like epics, but right now the generated system note body would change and that might break user integrations? So safer for now for this change to only affect issues where we have the new column.

How to set up and validate locally

This is a third step to complete #365399 (closed), so this change will only be testable via API once !93129 (merged) is merged. Splitting this change in smaller parts so it's easier to review.

Right now this can be tested from the console:

issue = Issue.last
issue.update!(start_date: Date.today, due_date: 1.week.from_now)

Issuable::CommonSystemNotesService.new(project: issue.project, current_user: User.first).execute(issue) }

Note.last.note

# note should read something like
# changed start date to September 20, 2018 and changed due date to September 25, 2018

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #365399 (closed)

Edited by Mario Celi

Merge request reports

Loading