diff --git a/app/models/notification_service.rb b/app/models/notification_service.rb index 6f0386d..934de82 100644 --- a/app/models/notification_service.rb +++ b/app/models/notification_service.rb @@ -66,8 +66,4 @@ class NotificationService def configured? api_token.present? end - - def problem_url(problem) - "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}/problems/#{problem.id}" - end end diff --git a/app/models/notification_services/hubot_service.rb b/app/models/notification_services/hubot_service.rb index 83f8023..6adb4c9 100644 --- a/app/models/notification_services/hubot_service.rb +++ b/app/models/notification_services/hubot_service.rb @@ -22,7 +22,7 @@ class NotificationServices::HubotService < NotificationService end def message_for_hubot(problem) - "[#{problem.app.name}][#{problem.environment}][#{problem.where}]: #{problem.error_class} #{problem_url(problem)}" + "[#{problem.app.name}][#{problem.environment}][#{problem.where}]: #{problem.error_class} #{problem.url}" end def create_notification(problem) diff --git a/app/models/notification_services/slack_service.rb b/app/models/notification_services/slack_service.rb index cd1af67..6c1f7ed 100644 --- a/app/models/notification_services/slack_service.rb +++ b/app/models/notification_services/slack_service.rb @@ -22,7 +22,7 @@ class NotificationServices::SlackService < NotificationService attachments: [ { fallback: message_for_slack(problem), - pretext: "<#{problem_url(problem)}|Errbit - #{problem.app.name}: #{problem.error_class}>", + pretext: "<#{problem.url}|Errbit - #{problem.app.name}: #{problem.error_class}>", color: "#D00000", fields: [ { diff --git a/app/models/notification_services/webhook_service.rb b/app/models/notification_services/webhook_service.rb index 119a7b5..45088d6 100644 --- a/app/models/notification_services/webhook_service.rb +++ b/app/models/notification_services/webhook_service.rb @@ -15,9 +15,7 @@ class NotificationServices::WebhookService < NotificationService def message_for_webhook(problem) { - problem: { - url: problem_url(problem) - }.merge(problem.as_json).to_json + problem: { url: problem.url }.merge(problem.as_json).to_json } end diff --git a/spec/models/notification_service/notification_service_spec.rb b/spec/models/notification_service/notification_service_spec.rb deleted file mode 100644 index c1e40aa..0000000 --- a/spec/models/notification_service/notification_service_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -describe NotificationServices, type: 'model' do - let(:notice) { Fabricate :notice } - let(:notification_service) { Fabricate :notification_service, app: notice.app } - let(:problem) { notice.problem } - - it "it should use http by default in #problem_url" do - expect(notification_service.problem_url(problem)).to start_with 'http://' - end - - it "it should use the protocol value specified in the config in #problem_url" do - allow(Errbit::Config).to receive(:protocol).and_return('https') - expect(notification_service.problem_url(problem)).to start_with 'https://' - end -end diff --git a/spec/models/notification_service/slack_service_spec.rb b/spec/models/notification_service/slack_service_spec.rb index 3e52a6c..0e80091 100644 --- a/spec/models/notification_service/slack_service_spec.rb +++ b/spec/models/notification_service/slack_service_spec.rb @@ -10,7 +10,7 @@ describe NotificationServices::SlackService, type: 'model' do attachments: [ { fallback: notification_service.message_for_slack(problem), - pretext: "<#{notification_service.problem_url(problem)}|Errbit - #{problem.app.name}: #{problem.error_class}>", + pretext: "<#{problem.url}|Errbit - #{problem.app.name}: #{problem.error_class}>", color: "#D00000", fields: [ { -- libgit2 0.21.2