summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-12-20 19:14:33 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-12-20 19:42:13 -0200
commitfed29117de6f30055d88daaa497ec18f85397ad6 (patch)
tree819ca4ddedde57b28acabf6b5993391bd6375b7c
parent1139da2745eb28be17c8fd6aa0f5de113c0f06a9 (diff)
downloadgitlab-ce-fed29117de6f30055d88daaa497ec18f85397ad6.tar.gz
Rename SlackNotificationService back to SlackService
-rw-r--r--app/models/project.rb2
-rw-r--r--app/models/project_services/slack_service.rb (renamed from app/models/project_services/slack_notification_service.rb)4
-rw-r--r--app/models/service.rb2
-rw-r--r--db/migrate/20141006143943_move_slack_service_to_webhook.rb2
-rw-r--r--db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb13
-rw-r--r--lib/api/services.rb2
-rw-r--r--spec/features/projects/import_export/test_project_export.tar.gzbin679415 -> 682154 bytes
-rw-r--r--spec/features/projects/services/slack_service_spec.rb4
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml2
-rw-r--r--spec/models/project_services/slack_service_spec.rb (renamed from spec/models/project_services/slack_notification_service_spec.rb)2
-rw-r--r--spec/models/project_spec.rb2
11 files changed, 16 insertions, 19 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 72d3da64f2d..5807ea5acdc 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -96,7 +96,7 @@ class Project < ActiveRecord::Base
has_one :mattermost_slash_commands_service, dependent: :destroy
has_one :mattermost_notification_service, dependent: :destroy
has_one :slack_slash_commands_service, dependent: :destroy
- has_one :slack_notification_service, dependent: :destroy
+ has_one :slack_service, dependent: :destroy
has_one :buildkite_service, dependent: :destroy
has_one :bamboo_service, dependent: :destroy
has_one :teamcity_service, dependent: :destroy
diff --git a/app/models/project_services/slack_notification_service.rb b/app/models/project_services/slack_service.rb
index 3cbf89efba4..0583470d3b5 100644
--- a/app/models/project_services/slack_notification_service.rb
+++ b/app/models/project_services/slack_service.rb
@@ -1,4 +1,4 @@
-class SlackNotificationService < ChatNotificationService
+class SlackService < ChatNotificationService
def title
'Slack notifications'
end
@@ -8,7 +8,7 @@ class SlackNotificationService < ChatNotificationService
end
def to_param
- 'slack_notification'
+ 'slack'
end
def help
diff --git a/app/models/service.rb b/app/models/service.rb
index 8abd8e73e43..918ed8206e0 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -222,7 +222,7 @@ class Service < ActiveRecord::Base
pushover
redmine
slack_slash_commands
- slack_notification
+ slack
teamcity
]
end
diff --git a/db/migrate/20141006143943_move_slack_service_to_webhook.rb b/db/migrate/20141006143943_move_slack_service_to_webhook.rb
index 42e88d6d6e3..561184615cc 100644
--- a/db/migrate/20141006143943_move_slack_service_to_webhook.rb
+++ b/db/migrate/20141006143943_move_slack_service_to_webhook.rb
@@ -5,7 +5,7 @@ class MoveSlackServiceToWebhook < ActiveRecord::Migration
DOWNTIME_REASON = 'Move old fields "token" and "subdomain" to one single field "webhook"'
def change
- SlackNotificationService.all.each do |slack_service|
+ SlackService.all.each do |slack_service|
if ["token", "subdomain"].all? { |property| slack_service.properties.key? property }
token = slack_service.properties['token']
subdomain = slack_service.properties['subdomain']
diff --git a/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb b/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb
index a7278d7b5a6..dc38d0ac906 100644
--- a/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb
+++ b/db/migrate/20161213172958_change_slack_service_to_slack_notification_service.rb
@@ -1,14 +1,11 @@
class ChangeSlackServiceToSlackNotificationService < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
- DOWNTIME = true
- DOWNTIME_REASON = 'Rename SlackService to SlackNotificationService'
+ DOWNTIME = false
- def up
- execute("UPDATE services SET type = 'SlackNotificationService' WHERE type = 'SlackService'")
- end
-
- def down
- execute("UPDATE services SET type = 'SlackService' WHERE type = 'SlackNotificationService'")
+ # This migration is a no-op, as it existed in an RC but we renamed
+ # SlackNotificationService back to SlackService:
+ # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8191#note_20310845
+ def change
end
end
diff --git a/lib/api/services.rb b/lib/api/services.rb
index aa97f6af0b2..44e668e3cf5 100644
--- a/lib/api/services.rb
+++ b/lib/api/services.rb
@@ -480,7 +480,7 @@ module API
desc: 'The description of the tracker'
}
],
- 'slack-notification' => [
+ 'slack' => [
{
required: true,
name: :webhook,
diff --git a/spec/features/projects/import_export/test_project_export.tar.gz b/spec/features/projects/import_export/test_project_export.tar.gz
index d3165d07d7b..7655c2b351f 100644
--- a/spec/features/projects/import_export/test_project_export.tar.gz
+++ b/spec/features/projects/import_export/test_project_export.tar.gz
Binary files differ
diff --git a/spec/features/projects/services/slack_service_spec.rb b/spec/features/projects/services/slack_service_spec.rb
index 320ed13a01d..16541f51d98 100644
--- a/spec/features/projects/services/slack_service_spec.rb
+++ b/spec/features/projects/services/slack_service_spec.rb
@@ -2,8 +2,8 @@ require 'spec_helper'
feature 'Projects > Slack service > Setup events', feature: true do
let(:user) { create(:user) }
- let(:service) { SlackNotificationService.new }
- let(:project) { create(:project, slack_notification_service: service) }
+ let(:service) { SlackService.new }
+ let(:project) { create(:project, slack_service: service) }
background do
service.fields
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 7e618e2fcf5..155cf8565b5 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -137,7 +137,7 @@ project:
- assembla_service
- asana_service
- gemnasium_service
-- slack_notification_service
+- slack_service
- mattermost_notification_service
- buildkite_service
- bamboo_service
diff --git a/spec/models/project_services/slack_notification_service_spec.rb b/spec/models/project_services/slack_service_spec.rb
index 110b5bf2115..9a3ecc66d83 100644
--- a/spec/models/project_services/slack_notification_service_spec.rb
+++ b/spec/models/project_services/slack_service_spec.rb
@@ -1,5 +1,5 @@
require 'spec_helper'
-describe SlackNotificationService, models: true do
+describe SlackService, models: true do
it_behaves_like "slack or mattermost notifications"
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 0455cd2fe49..569071c0418 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -21,7 +21,7 @@ describe Project, models: true do
it { is_expected.to have_many(:hooks).dependent(:destroy) }
it { is_expected.to have_many(:protected_branches).dependent(:destroy) }
it { is_expected.to have_one(:forked_project_link).dependent(:destroy) }
- it { is_expected.to have_one(:slack_notification_service).dependent(:destroy) }
+ it { is_expected.to have_one(:slack_service).dependent(:destroy) }
it { is_expected.to have_one(:mattermost_notification_service).dependent(:destroy) }
it { is_expected.to have_one(:pushover_service).dependent(:destroy) }
it { is_expected.to have_one(:asana_service).dependent(:destroy) }