app/commands/decidim/accountability/admin/update_timeline_entry.rb in decidim-accountability-0.26.10 vs app/commands/decidim/accountability/admin/update_timeline_entry.rb in decidim-accountability-0.27.0.rc1
- old
+ new
@@ -3,18 +3,19 @@
module Decidim
module Accountability
module Admin
# This command is executed when the user changes a Result from the admin
# panel.
- class UpdateTimelineEntry < Rectify::Command
+ class UpdateTimelineEntry < Decidim::Command
# Initializes an UpdateTimelineEntry Command.
#
# form - The form from which to get the data.
# timeline_entry - The current instance of the timeline_entry to be updated.
- def initialize(form, timeline_entry)
+ def initialize(form, timeline_entry, user)
@form = form
@timeline_entry = timeline_entry
+ @user = user
end
# Updates the timeline_entry if valid.
#
# Broadcasts :ok if successful, :invalid otherwise.
@@ -31,12 +32,15 @@
private
attr_reader :timeline_entry, :form
def update_timeline_entry
- timeline_entry.update!(
- entry_date: @form.entry_date,
- description: @form.description
+ Decidim.traceability.update!(
+ timeline_entry,
+ @user,
+ entry_date: form.entry_date,
+ title: form.title,
+ description: form.description
)
end
end
end
end