diff options
Diffstat (limited to 'app/models/integrations/campfire.rb')
-rw-r--r-- | app/models/integrations/campfire.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/app/models/integrations/campfire.rb b/app/models/integrations/campfire.rb index 007578e5830..8b5797a9d24 100644 --- a/app/models/integrations/campfire.rb +++ b/app/models/integrations/campfire.rb @@ -2,7 +2,7 @@ module Integrations class Campfire < Integration - SUBDOMAIN_REGEXP = %r{\A[a-z](?:[a-z0-9-]*[a-z0-9])?\z}i.freeze + SUBDOMAIN_REGEXP = %r{\A[a-z](?:[a-z0-9-]*[a-z0-9])?\z}i validates :token, presence: true, if: :activated? validates :room, @@ -26,12 +26,9 @@ module Integrations placeholder: '', exposes_secrets: true, help: -> do - ERB::Util.html_escape( + format(ERB::Util.html_escape( s_('CampfireService|The %{code_open}.campfirenow.com%{code_close} subdomain.') - ) % { - code_open: '<code>'.html_safe, - code_close: '</code>'.html_safe - } + ), code_open: '<code>'.html_safe, code_close: '</code>'.html_safe) end field :room, @@ -48,13 +45,16 @@ module Integrations end def help - docs_link = ActionController::Base.helpers.link_to _('Learn more.'), Rails.application.routes.url_helpers.help_page_url('api/services', anchor: 'campfire'), target: '_blank', rel: 'noopener noreferrer' - - ERB::Util.html_escape( + docs_link = ActionController::Base.helpers.link_to( + _('Learn more.'), + Rails.application.routes.url_helpers.help_page_url('api/integrations', anchor: 'campfire'), + target: '_blank', + rel: 'noopener noreferrer' + ) + + format(ERB::Util.html_escape( s_('CampfireService|Send notifications about push events to Campfire chat rooms. %{docs_link}') - ) % { - docs_link: docs_link.html_safe - } + ), docs_link: docs_link.html_safe) end def self.to_param @@ -62,14 +62,14 @@ module Integrations end def self.supported_events - %w(push) + %w[push] end def execute(data) return unless supported_events.include?(data[:object_kind]) message = create_message(data) - speak(self.room, message, auth) + speak(room, message, auth) end private @@ -96,7 +96,7 @@ module Integrations room = rooms(auth).find { |r| r["name"] == room_name } return unless room - path = "/room/#{room["id"]}/speak.json" + path = "/room/#{room['id']}/speak.json" body = { body: { message: { |