diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /app/services/resource_events | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/services/resource_events')
-rw-r--r-- | app/services/resource_events/base_synthetic_notes_builder_service.rb | 2 | ||||
-rw-r--r-- | app/services/resource_events/change_milestone_service.rb | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/app/services/resource_events/base_synthetic_notes_builder_service.rb b/app/services/resource_events/base_synthetic_notes_builder_service.rb index 1b85ca811a1..db8bf6e4b74 100644 --- a/app/services/resource_events/base_synthetic_notes_builder_service.rb +++ b/app/services/resource_events/base_synthetic_notes_builder_service.rb @@ -26,7 +26,7 @@ module ResourceEvents def since_fetch_at(events) return events unless params[:last_fetched_at].present? - last_fetched_at = Time.at(params.fetch(:last_fetched_at).to_i) + last_fetched_at = Time.zone.at(params.fetch(:last_fetched_at).to_i) events.created_after(last_fetched_at - NotesFinder::FETCH_OVERLAP) end diff --git a/app/services/resource_events/change_milestone_service.rb b/app/services/resource_events/change_milestone_service.rb index ea196822f74..82c3e2acad5 100644 --- a/app/services/resource_events/change_milestone_service.rb +++ b/app/services/resource_events/change_milestone_service.rb @@ -2,13 +2,14 @@ module ResourceEvents class ChangeMilestoneService - attr_reader :resource, :user, :event_created_at, :milestone + attr_reader :resource, :user, :event_created_at, :milestone, :old_milestone - def initialize(resource, user, created_at: Time.now) + def initialize(resource, user, created_at: Time.current, old_milestone:) @resource = resource @user = user @event_created_at = created_at @milestone = resource&.milestone + @old_milestone = old_milestone end def execute @@ -26,7 +27,7 @@ module ResourceEvents { user_id: user.id, created_at: event_created_at, - milestone_id: milestone&.id, + milestone_id: action == :add ? milestone&.id : old_milestone&.id, state: ResourceMilestoneEvent.states[resource.state], action: ResourceMilestoneEvent.actions[action], key => resource.id |