2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
class Projects::AvatarsController < Projects::ApplicationController
|
2018-11-20 20:47:30 +05:30
|
|
|
include SendsBlob
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
before_action :authorize_admin_project!, only: [:destroy]
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
feature_category :projects
|
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
urgency :low, [:show]
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def show
|
2016-09-29 09:46:39 +05:30
|
|
|
@blob = @repository.blob_at_branch(@repository.root_ref, @project.avatar_in_git)
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
send_blob(@repository, @blob, allow_caching: @project.public?)
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@project.remove_avatar!
|
|
|
|
@project.save
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
redirect_to edit_project_path(@project, anchor: 'js-general-project-settings'), status: :found
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|