gitlab-org--gitlab-foss/app/controllers/projects/avatars_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
635 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Projects::AvatarsController < Projects::ApplicationController
include SendsBlob
skip_before_action :default_cache_headers, only: :show
2016-03-20 16:03:53 -04:00
before_action :authorize_admin_project!, only: [:destroy]
feature_category :projects
urgency :low, [:show]
def show
@blob = @repository.blob_at_branch(@repository.root_ref, @project.avatar_in_git)
2016-03-07 08:27:53 -05:00
send_blob(@repository, @blob, allow_caching: @project.public?)
end
def destroy
@project.remove_avatar!
@project.save
redirect_to edit_project_path(@project, anchor: 'js-general-project-settings'), status: :found
end
end