2018-09-25 23:45:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-01-25 12:15:44 -05:00
|
|
|
class Projects::AvatarsController < Projects::ApplicationController
|
2018-08-30 08:34:41 -04:00
|
|
|
include SendsBlob
|
2016-02-24 05:53:30 -05:00
|
|
|
|
2016-03-20 16:03:53 -04:00
|
|
|
before_action :authorize_admin_project!, only: [:destroy]
|
2014-01-25 12:15:44 -05:00
|
|
|
|
|
|
|
def show
|
2016-08-12 10:29:13 -04:00
|
|
|
@blob = @repository.blob_at_branch(@repository.root_ref, @project.avatar_in_git)
|
2016-03-07 08:27:53 -05:00
|
|
|
|
2020-03-30 14:08:07 -04:00
|
|
|
send_blob(@repository, @blob, allow_caching: @project.public?)
|
2014-01-25 12:15:44 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@project.remove_avatar!
|
|
|
|
@project.save
|
|
|
|
|
2018-08-08 06:57:34 -04:00
|
|
|
redirect_to edit_project_path(@project, anchor: 'js-general-project-settings'), status: :found
|
2014-01-25 12:15:44 -05:00
|
|
|
end
|
|
|
|
end
|