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