summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2016-11-14 12:41:14 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-11-17 21:34:23 +0100
commit4762198959fbc2bc22981749313955b65c6d6026 (patch)
treee759e8a0814f16de23a1a2bb02b6960de1da6472
parent9191f538ba97f59d09c6ffbb747e4a34e30231ee (diff)
downloadgitlab-ce-4762198959fbc2bc22981749313955b65c6d6026.tar.gz
Remove duplication of implementations
-rw-r--r--app/controllers/chat_ops_controller.rb10
-rw-r--r--app/models/project_services/chat_service.rb3
-rw-r--r--app/models/project_services/mattermost_chat_service.rb2
-rw-r--r--config/routes.rb5
-rw-r--r--spec/controllers/chat_ops_controller_spec.rb11
5 files changed, 3 insertions, 28 deletions
diff --git a/app/controllers/chat_ops_controller.rb b/app/controllers/chat_ops_controller.rb
deleted file mode 100644
index 2754de5e710..00000000000
--- a/app/controllers/chat_ops_controller.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class ChatOpsController < ApplicationController
- respond_to :json
-
- skip_before_action :verify_authenticity_token
- skip_before_action :authenticate_user!
-
- def trigger
- render json: { ok: true }
- end
-end
diff --git a/app/models/project_services/chat_service.rb b/app/models/project_services/chat_service.rb
index c1b6369a5bd..f6d190dead5 100644
--- a/app/models/project_services/chat_service.rb
+++ b/app/models/project_services/chat_service.rb
@@ -1,4 +1,5 @@
# Base class for Chat services
+# This class is not meant to be used directly, but only to inherrit from.
class ChatService < Service
default_value_for :category, 'chat'
@@ -12,7 +13,7 @@ class ChatService < Service
end
def trigger(params)
- # implement inside child
+ raise NotImplementedError
end
def chat_user_params(params)
diff --git a/app/models/project_services/mattermost_chat_service.rb b/app/models/project_services/mattermost_chat_service.rb
index 2adcbf5e5ce..f4a392ee17e 100644
--- a/app/models/project_services/mattermost_chat_service.rb
+++ b/app/models/project_services/mattermost_chat_service.rb
@@ -5,7 +5,7 @@ class MattermostChatService < ChatService
end
def description
- 'Self-hosted Slack-alternative'
+ 'Mattermost is an open source, self-hosted Slack-alternative'
end
def to_param
diff --git a/config/routes.rb b/config/routes.rb
index b1de4ba3821..7bf6c03e69b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -68,11 +68,6 @@ Rails.application.routes.draw do
# Notification settings
resources :notification_settings, only: [:create, :update]
- # For slash commands to POST
- namespace :chat_ops do
- post :trigger
- end
-
draw :import
draw :uploads
draw :explore
diff --git a/spec/controllers/chat_ops_controller_spec.rb b/spec/controllers/chat_ops_controller_spec.rb
deleted file mode 100644
index 7303c981ba2..00000000000
--- a/spec/controllers/chat_ops_controller_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe ChatOpsController, type: :controller do
- describe "POST #trigger" do
- it "returns http success" do
- post :trigger
-
- expect(response).to have_http_status(:success)
- end
- end
-end