Update last_modified_by for assets on edit [SCI-10033]

This commit is contained in:
Ivan Kljun 2024-01-24 15:18:34 +01:00
parent cc29759dd9
commit 24faeae5de
4 changed files with 5 additions and 2 deletions

View file

@ -34,7 +34,7 @@ class AssetSyncController < ApplicationController
end end
@asset.file.attach(io: request.body, filename: @asset.file.filename) @asset.file.attach(io: request.body, filename: @asset.file.filename)
@asset.touch @asset.update(last_modified_by: current_user)
log_activity log_activity

View file

@ -187,6 +187,7 @@ class AssetsController < ApplicationController
return render_403 unless can_read_team?(@asset.team) return render_403 unless can_read_team?(@asset.team)
@asset.file.attach(io: params.require(:image), filename: orig_file_name) @asset.file.attach(io: params.require(:image), filename: orig_file_name)
@asset.last_modified_by = current_user
@asset.save! @asset.save!
create_edit_image_activity(@asset, current_user, :finish_editing) create_edit_image_activity(@asset, current_user, :finish_editing)
# release previous image space # release previous image space

View file

@ -91,6 +91,7 @@ class GeneSequenceAssetsController < ApplicationController
file.blob.metadata['name'] = params[:sequence_name] file.blob.metadata['name'] = params[:sequence_name]
file.save! file.save!
@asset.view_mode = view_mode || @parent.assets_view_mode @asset.view_mode = view_mode || @parent.assets_view_mode
@asset.last_modified_by = current_user
@asset.save! @asset.save!
end end
end end

View file

@ -28,7 +28,7 @@ class MarvinJsService
connect_asset(asset, params, current_user) connect_asset(asset, params, current_user)
end end
def update_sketch(params, _current_user, current_team) def update_sketch(params, current_user, current_team)
if params[:object_type] == 'TinyMceAsset' if params[:object_type] == 'TinyMceAsset'
asset = current_team.tiny_mce_assets.find(Base62.decode(params[:id])) asset = current_team.tiny_mce_assets.find(Base62.decode(params[:id]))
attachment = asset&.image attachment = asset&.image
@ -40,6 +40,7 @@ class MarvinJsService
file = generate_image(params) file = generate_image(params)
attach_file(attachment, file, params) attach_file(attachment, file, params)
asset.update(last_modified_by: current_user) if asset.is_a?(Asset)
asset.post_process_file(current_team) if asset.class == Asset asset.post_process_file(current_team) if asset.class == Asset
asset asset
end end