Commit 0499bdc1 authored by Sean McGivern's avatar Sean McGivern Committed by Douglas Barbosa Alexandre

Merge branch 'fix/25843' into 'master'

Rename SlackNotificationService back to SlackService

See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8191#note_20310845

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/25843

/cc @yorickpeterse @stanhu @smcgivern @felipe_artur @ayufan

See merge request !8208
parent 431b9d1b
...@@ -95,8 +95,8 @@ class Project < ActiveRecord::Base ...@@ -95,8 +95,8 @@ class Project < ActiveRecord::Base
has_one :asana_service, dependent: :destroy has_one :asana_service, dependent: :destroy
has_one :gemnasium_service, dependent: :destroy has_one :gemnasium_service, dependent: :destroy
has_one :mattermost_slash_commands_service, dependent: :destroy has_one :mattermost_slash_commands_service, dependent: :destroy
has_one :mattermost_notification_service, dependent: :destroy has_one :mattermost_service, dependent: :destroy
has_one :slack_notification_service, dependent: :destroy has_one :slack_service, dependent: :destroy
has_one :buildkite_service, dependent: :destroy has_one :buildkite_service, dependent: :destroy
has_one :bamboo_service, dependent: :destroy has_one :bamboo_service, dependent: :destroy
has_one :teamcity_service, dependent: :destroy has_one :teamcity_service, dependent: :destroy
......
class MattermostNotificationService < ChatNotificationService class MattermostService < ChatNotificationService
def title def title
'Mattermost notifications' 'Mattermost notifications'
end end
...@@ -8,7 +8,7 @@ class MattermostNotificationService < ChatNotificationService ...@@ -8,7 +8,7 @@ class MattermostNotificationService < ChatNotificationService
end end
def to_param def to_param
'mattermost_notification' 'mattermost'
end end
def help def help
......
class SlackNotificationService < ChatNotificationService class SlackService < ChatNotificationService
def title def title
'Slack notifications' 'Slack notifications'
end end
...@@ -8,7 +8,7 @@ class SlackNotificationService < ChatNotificationService ...@@ -8,7 +8,7 @@ class SlackNotificationService < ChatNotificationService
end end
def to_param def to_param
'slack_notification' 'slack'
end end
def help def help
......
...@@ -216,12 +216,12 @@ class Service < ActiveRecord::Base ...@@ -216,12 +216,12 @@ class Service < ActiveRecord::Base
jira jira
kubernetes kubernetes
mattermost_slash_commands mattermost_slash_commands
mattermost
pipelines_email pipelines_email
pivotaltracker pivotaltracker
pushover pushover
redmine redmine
mattermost_notification slack
slack_notification
teamcity teamcity
] ]
end end
......
...@@ -5,7 +5,7 @@ class MoveSlackServiceToWebhook < ActiveRecord::Migration ...@@ -5,7 +5,7 @@ class MoveSlackServiceToWebhook < ActiveRecord::Migration
DOWNTIME_REASON = 'Move old fields "token" and "subdomain" to one single field "webhook"' DOWNTIME_REASON = 'Move old fields "token" and "subdomain" to one single field "webhook"'
def change def change
SlackNotificationService.all.each do |slack_service| SlackService.all.each do |slack_service|
if ["token", "subdomain"].all? { |property| slack_service.properties.key? property } if ["token", "subdomain"].all? { |property| slack_service.properties.key? property }
token = slack_service.properties['token'] token = slack_service.properties['token']
subdomain = slack_service.properties['subdomain'] subdomain = slack_service.properties['subdomain']
......
class ChangeSlackServiceToSlackNotificationService < ActiveRecord::Migration class ChangeSlackServiceToSlackNotificationService < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
DOWNTIME = true DOWNTIME = false
DOWNTIME_REASON = 'Rename SlackService to SlackNotificationService'
def up # This migration is a no-op, as it existed in an RC but we renamed
execute("UPDATE services SET type = 'SlackNotificationService' WHERE type = 'SlackService'") # SlackNotificationService back to SlackService:
end # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8191#note_20310845
def change
def down
execute("UPDATE services SET type = 'SlackService' WHERE type = 'SlackNotificationService'")
end end
end end
...@@ -473,7 +473,7 @@ module API ...@@ -473,7 +473,7 @@ module API
desc: 'The description of the tracker' desc: 'The description of the tracker'
} }
], ],
'slack-notification' => [ 'slack' => [
{ {
required: true, required: true,
name: :webhook, name: :webhook,
...@@ -493,7 +493,7 @@ module API ...@@ -493,7 +493,7 @@ module API
desc: 'The channel name' desc: 'The channel name'
} }
], ],
'mattermost-notification' => [ 'mattermost' => [
{ {
required: true, required: true,
name: :webhook, name: :webhook,
......
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
feature 'Projects > Slack service > Setup events', feature: true do feature 'Projects > Slack service > Setup events', feature: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:service) { SlackNotificationService.new } let(:service) { SlackService.new }
let(:project) { create(:project, slack_notification_service: service) } let(:project) { create(:project, slack_service: service) }
background do background do
service.fields service.fields
......
...@@ -136,8 +136,8 @@ project: ...@@ -136,8 +136,8 @@ project:
- assembla_service - assembla_service
- asana_service - asana_service
- gemnasium_service - gemnasium_service
- slack_notification_service - slack_service
- mattermost_notification_service - mattermost_service
- buildkite_service - buildkite_service
- bamboo_service - bamboo_service
- teamcity_service - teamcity_service
......
require 'spec_helper' require 'spec_helper'
describe SlackNotificationService, models: true do describe MattermostService, models: true do
it_behaves_like "slack or mattermost" it_behaves_like "slack or mattermost"
end end
require 'spec_helper' require 'spec_helper'
describe MattermostNotificationService, models: true do describe SlackService, models: true do
it_behaves_like "slack or mattermost" it_behaves_like "slack or mattermost"
end end
...@@ -22,8 +22,8 @@ describe Project, models: true do ...@@ -22,8 +22,8 @@ describe Project, models: true do
it { is_expected.to have_many(:protected_branches).dependent(:destroy) } it { is_expected.to have_many(:protected_branches).dependent(:destroy) }
it { is_expected.to have_many(:chat_services) } it { is_expected.to have_many(:chat_services) }
it { is_expected.to have_one(:forked_project_link).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(:mattermost_service).dependent(:destroy) }
it { is_expected.to have_one(:pushover_service).dependent(:destroy) } it { is_expected.to have_one(:pushover_service).dependent(:destroy) }
it { is_expected.to have_one(:asana_service).dependent(:destroy) } it { is_expected.to have_one(:asana_service).dependent(:destroy) }
it { is_expected.to have_many(:boards).dependent(:destroy) } it { is_expected.to have_many(:boards).dependent(:destroy) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment