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

image.rb « diff_viewer « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28489be9dfa1cf01cb417ae4dc361903cd3a1783 (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
25
# frozen_string_literal: true

module DiffViewer
  class Image < Base
    include Rich
    include ClientSide

    self.partial_name = 'image'
    self.extensions = UploaderHelper::SAFE_IMAGE_EXT
    self.binary = true
    self.switcher_icon = 'doc-image'

    def self.switcher_title
      _('image diff')
    end

    def self.can_render?(diff_file, verify_binary: true)
      # When both blobs are missing, we often still have a textual diff that can
      # be displayed
      return false if diff_file.old_blob.nil? && diff_file.new_blob.nil?

      super
    end
  end
end