Welcome to mirror list, hosted at ThFree Co, Russian Federation.

avatars_controller.rb « projects « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3728406afd34e6cd88a79a61a0a4173eec016150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

class Projects::AvatarsController < Projects::ApplicationController
  include SendsBlob

  before_action :authorize_admin_project!, only: [:destroy]

  feature_category :groups_and_projects

  urgency :low, [:show]

  def show
    @blob = @repository.blob_at_branch(@repository.root_ref, @project.avatar_in_git)

    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