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

shimo.rb « integrations « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8bc296e03207620c71bec0f673b01bcaf698e922 (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
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true

module Integrations
  class Shimo < BaseThirdPartyWiki
    validates :external_wiki_url, presence: true, public_url: true, if: :activated?

    field :external_wiki_url,
      title: -> { s_('Shimo|Shimo Workspace URL') },
      required: true

    def render?
      return false unless Feature.enabled?(:shimo_integration, project)

      valid? && activated?
    end

    def title
      s_('Shimo|Shimo')
    end

    def description
      s_('Shimo|Link to a Shimo Workspace from the sidebar.')
    end

    def self.to_param
      'shimo'
    end

    # support for `test` method
    def execute(_data)
      response = Gitlab::HTTP.get(properties['external_wiki_url'], verify: true)
      response.body if response.code == 200
    rescue StandardError
      nil
    end
  end
end