gitlab-org--gitlab-foss/app/models/blob_viewer
Kamil Trzciński c4d615c9dc Allow to include files from another projects
This adds `project:, file:, ref:` specification support.
2019-01-07 09:38:05 +01:00
..
auxiliary.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
balsamiq.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
base.rb Fixing image lfs bug and also displaying text lfs 2018-12-27 16:51:07 +01:00
binary_stl.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
cartfile.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
changelog.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
client_side.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
composer_json.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
contributing.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
dependency_manager.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
download.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
empty.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
gemfile.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
gemspec.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
gitlab_ci_yml.rb Allow to include files from another projects 2019-01-07 09:38:05 +01:00
godeps_json.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
image.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
license.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
markup.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
notebook.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
package_json.rb Fix xss vulnerability sourced from package.json's homepage 2018-09-19 09:13:33 +08:00
pdf.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
podfile.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
podspec.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
podspec_json.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
readme.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
requirements_txt.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
rich.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
route_map.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
server_side.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
simple.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
sketch.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
static.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
svg.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
text.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
text_stl.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
video.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00
yarn_lock.rb Enable frozen string for app/models/**/*.rb 2018-08-03 01:44:16 -07:00

# 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