Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Replace avatar saving

Oliver Günther5f44166ad965
diff --git a/modules/avatars/lib/open_project/avatars/patches/user_patch.rb b/modules/avatars/lib/open_project/avatars/patches/user_patch.rb
index f675d5874cb..4b5d96b30e8 100644
--- a/modules/avatars/lib/open_project/avatars/patches/user_patch.rb
+++ b/modules/avatars/lib/open_project/avatars/patches/user_patch.rb
@@ -60,8 +60,12 @@ module OpenProject::Avatars
local_avatar_attachment&.destroy
reset_avatar_attachment_cache!
- attach_files('first' => { 'file' => file, 'description' => 'avatar' })
- save
+ @local_avatar_attachment = Attachments::CreateService
+ .new(user: User.system, contract_class: EmptyContract)
+ .call(file: file, container: self, filename: file.original_filename, description: 'avatar')
+ .result
+
+ touch
end
def reset_avatar_attachment_cache!