]> git.openstreetmap.org Git - rails.git/blob - app/controllers/profiles/images_controller.rb
Merge pull request #6394 from openstreetmap/dependabot/github_actions/ruby/setup...
[rails.git] / app / controllers / profiles / images_controller.rb
1 # frozen_string_literal: true
2
3 module Profiles
4   class ImagesController < ProfileSectionsController
5     private
6
7     def update_profile
8       case params[:avatar_action]
9       when "new"
10         current_user.avatar.attach(params[:user][:avatar])
11         current_user.image_use_gravatar = false
12       when "delete"
13         current_user.avatar.purge_later
14         current_user.image_use_gravatar = false
15       when "gravatar"
16         current_user.avatar.purge_later
17         current_user.image_use_gravatar = true
18       end
19
20       current_user.save
21     end
22   end
23 end