gitlab-org--gitlab-foss/app/models/blob_viewer
2020-07-13 12:09:18 +00:00
..
audio.rb
auxiliary.rb
balsamiq.rb
base.rb
binary_stl.rb
cargo_toml.rb
cartfile.rb
changelog.rb
client_side.rb
composer_json.rb
contributing.rb
dependency_manager.rb
download.rb
empty.rb
gemfile.rb
gemspec.rb
gitlab_ci_yml.rb
go_mod.rb
godeps_json.rb
image.rb Add latest changes from gitlab-org/gitlab@master 2020-07-13 12:09:18 +00:00
license.rb
markup.rb
metrics_dashboard_yml.rb
notebook.rb Add latest changes from gitlab-org/gitlab@master 2020-07-13 12:09:18 +00:00
open_api.rb Add latest changes from gitlab-org/gitlab@master 2020-07-13 12:09:18 +00:00
package_json.rb
pdf.rb
podfile.rb
podspec.rb
podspec_json.rb
readme.rb
requirements_txt.rb
rich.rb Add latest changes from gitlab-org/gitlab@master 2020-07-13 12:09:18 +00:00
route_map.rb
server_side.rb
simple.rb
sketch.rb
static.rb
svg.rb Add latest changes from gitlab-org/gitlab@master 2020-07-13 12:09:18 +00:00
text.rb
text_stl.rb
video.rb
yarn_lock.rb

# frozen_string_literal: true

module BlobViewer
  class Readme < Base
    include Auxiliary
    include Static

    self.partial_name = 'readme'
    self.file_types = %i(readme)
    self.binary = false

    def visible_to?(current_user)
      can?(current_user, :read_wiki, project)
    end

    def render_error
      return if project.has_external_wiki? || (project.wiki_enabled? && project.wiki.has_home_page?)

      :no_wiki
    end
  end
end