This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2020-04-20 05:03:03 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Settings
|
|
|
|
class PicturesController < BaseController
|
|
|
|
before_action :set_account
|
|
|
|
before_action :set_picture
|
|
|
|
|
|
|
|
def destroy
|
2020-06-29 04:56:55 -07:00
|
|
|
if valid_picture?
|
|
|
|
msg = I18n.t('generic.changes_saved_msg') if UpdateAccountService.new.call(@account, { @picture => nil, "#{@picture}_remote_url" => '' })
|
2020-04-20 05:03:03 -07:00
|
|
|
redirect_to settings_profile_path, notice: msg, status: 303
|
|
|
|
else
|
|
|
|
bad_request
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_account
|
|
|
|
@account = current_account
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_picture
|
|
|
|
@picture = params[:id]
|
|
|
|
end
|
|
|
|
|
2020-06-29 04:56:55 -07:00
|
|
|
def valid_picture?
|
|
|
|
%w(avatar header).include?(@picture)
|
2020-04-20 05:03:03 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|