Skip to content

Commit

Permalink
Merge pull request #1439 from alphagov/remove-gds-zendesk
Browse files Browse the repository at this point in the history
Remove gds_zendesk
  • Loading branch information
AgaDufrat authored Aug 15, 2024
2 parents 42254d0 + e00411c commit 9750235
Show file tree
Hide file tree
Showing 26 changed files with 24 additions and 70 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public/assets
# Ignore Byebug command history file.
.byebug_history

config/zendesk.yml

# Ignore RSpec state file
/spec/examples.txt

Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ gem "cancancan"
gem "dartsass-rails"
gem "gds-api-adapters"
gem "gds-sso"
gem "gds_zendesk"
gem "govuk_admin_template"
gem "govuk_app_config"
gem "govuk_publishing_components"
Expand Down
15 changes: 0 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ GEM
faraday (2.10.0)
faraday-net_http (>= 2.0, < 3.2)
logger
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (3.1.0)
net-http
ffi (1.17.0-aarch64-linux-gnu)
Expand All @@ -176,9 +174,6 @@ GEM
rails (>= 7)
warden (~> 1.2)
warden-oauth2 (~> 0.0.1)
gds_zendesk (3.7.0)
null_logger (~> 0)
zendesk_api (>= 1.37, < 4.0)
globalid (1.2.1)
activesupport (>= 6.1)
google-protobuf (4.27.3-aarch64-linux)
Expand Down Expand Up @@ -241,7 +236,6 @@ GEM
domain_name (~> 0.5)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
io-console (0.7.2)
irb (1.14.0)
rdoc (>= 4.0.0)
Expand Down Expand Up @@ -296,7 +290,6 @@ GEM
msgpack (1.7.2)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
multipart-post (2.4.1)
mutex_m (0.2.0)
net-http (0.4.1)
uri
Expand Down Expand Up @@ -767,13 +760,6 @@ GEM
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.17)
zendesk_api (3.1.0)
faraday (> 2.0.0)
faraday-multipart
hashie (>= 3.5.2, < 6.0.0)
inflection
mini_mime
multipart-post (~> 2.0)

PLATFORMS
aarch64-linux
Expand All @@ -789,7 +775,6 @@ DEPENDENCIES
factory_bot_rails
gds-api-adapters
gds-sso
gds_zendesk
govuk_admin_template
govuk_app_config
govuk_publishing_components
Expand Down
3 changes: 0 additions & 3 deletions app/controllers/change_existing_user_requests_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
require "gds_zendesk/users"
require "zendesk_api/error"

class ChangeExistingUserRequestsController < RequestsController
protected

Expand Down
3 changes: 0 additions & 3 deletions app/controllers/create_new_user_requests_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
require "gds_zendesk/users"
require "zendesk_api/error"

class CreateNewUserRequestsController < RequestsController
include ExploreHelper

Expand Down
1 change: 1 addition & 0 deletions app/models/support/requests/requester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Requester
attr_reader :email

VALID_EMAIL_REGEX = /\A[\w+\-.']+@[a-z\d\-.]+\.[a-z]+\z/i
ZENDESK_ANONYMOUS_TICKETS_REQUESTER_EMAIL = ENV["ZENDESK_ANONYMOUS_TICKETS_REQUESTER_EMAIL"] || "[email protected]"

validates :email, presence: true

Expand Down
15 changes: 0 additions & 15 deletions config/initializers/gds_zendesk.rb

This file was deleted.

3 changes: 2 additions & 1 deletion docs/zendesk-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## How tickets are published to Zendesk

The [gds_zendesk](https://github.com/alphagov/gds_zendesk) gem provides a client to communicate with Zendesk. This `GDSZendesk::Client` is [initialised in `config/initializers/gds_zendesk.rb`](https://github.com/alphagov/support/blob/065e1596eb401806530a4e85cc4b70a15b9d4a7d/config/initializers/gds_zendesk.rb#L14). The client has a `ticket.create!` method, which is [invoked by the `ZendeskTicketWorker`](https://github.com/alphagov/support/blob/a57843ea587a296a90958b97e5b07baf194c5bf1/app/workers/zendesk_ticket_worker.rb#L27).
Support app uses Support API as a client to communicate with Zendesk by calling the [`/support-tickets` endpoint](https://github.com/alphagov/support-api/blob/c0b6ca3587f6673c9512573deeecd66a2aaa0d98/app/controllers/support_tickets_controller.rb). `Services.support_api` is [instantiated in `app/lib/services.rb`](app/lib/services.rb).
The endpoint is exposed via gds_api_adapters gem's [`.raise_support_ticket` method](https://github.com/alphagov/gds-api-adapters/blob/9aabf9d/lib/gds_api/support_api.rb#L25-L39), which is [invoked by the `ZendeskTicketWorker`](https://github.com/alphagov/support/blob/a57843ea587a296a90958b97e5b07baf194c5bf1/app/workers/zendesk_ticket_worker.rb#L27).

The `ZendeskTicketWorker` is [created by the `ZendeskTickets` class](https://github.com/alphagov/support/blob/fdf8968f84231f2365207215e40cbaccad2fa6a1/app/models/zendesk/zendesk_tickets.rb#L15), which has a `raise_ticket` method that takes an object of type [`Zendesk::ZendeskTicket`](https://github.com/alphagov/support/blob/37fa7b05ec92511361b2a5e85f2c9f1a1bb3fb51/app/models/zendesk/zendesk_ticket.rb#L6) (or any child class thereof). `ZendeskTickets` is [instantiated in the `RequestsController`](https://github.com/alphagov/support/blob/564e53dc8a3d7a679b0c7f3ff52b91b3dd12e56d/app/controllers/requests_controller.rb#L36) on submission of one of the [live Support forms](https://support.publishing.service.gov.uk/) (one of the forms in the "User access", "Content request", "Technical support", "Campaigns", "Feedback for tools in Beta", "Topic taxonomy requests" or "Other requests" groups). The resulting ticket is tagged as per the `tag` method in whichever `Zendesk::ZendeskTicket` subclass it is, e.g. [`content_amend` tag for the `ContentChangeRequestTicket`](https://github.com/alphagov/support/blob/bcd9984967f70e5338b21455debb3ecd72684de3/app/models/zendesk/ticket/content_change_request_ticket.rb#L10-L12) as well as the default `govt_form` tag [present on the parent class](https://github.com/alphagov/support/blob/37fa7b05ec92511361b2a5e85f2c9f1a1bb3fb51/app/models/zendesk/zendesk_ticket.rb#L50-L52).

Expand Down
2 changes: 1 addition & 1 deletion spec/features/analytics_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Request for analytics",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form analytics],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/campaign_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Campaign",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form campaign],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/change_existing_user_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

scenario "changing user permissions" do
ticket_request = expect_zendesk_to_receive_ticket(
ticket_request = expect_support_api_to_receive_raise_ticket(
"subject" => "Change an existing user's account",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form change_user],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/changes_to_publishing_apps_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Abc",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form new_feature_request],
Expand Down
4 changes: 2 additions & 2 deletions spec/features/content_advice_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Needed by 12 Jan: Which format - Advice on content",
"tags" => %w[govt_form dept_content_advice],
"description" =>
Expand Down Expand Up @@ -46,7 +46,7 @@
end

scenario "successful request with other reaason" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Tricky query - Advice on content",
"tags" => %w[govt_form dept_content_advice],
"description" =>
Expand Down
2 changes: 1 addition & 1 deletion spec/features/content_change_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end

scenario "successful mainstream content change request " do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Update X",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form content_amend],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/content_data_feedback_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Content Data feedback",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form content_data_feedback],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/create_new_user_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
])

ticket_request = expect_zendesk_to_receive_ticket(
ticket_request = expect_support_api_to_receive_raise_ticket(
"subject" => "Create a new user account",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form create_new_user],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/general_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Downtime - Govt Agency General Issue",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form govt_agency_general],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/live_campaign_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Live Campaign",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form live_campaign],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/remove_user_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Remove user",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form remove_user],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Report an issue with GOV.UK search results",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form site_search],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/taxonomy_change_topic_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Taxonomy change topic request - \"Abc\"",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form taxonomy_change_topic_request],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/taxonomy_new_topic_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

scenario "successful request" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Taxonomy new topic request - \"Abc\"",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form taxonomy_new_topic_request],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/technical_fault_reports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

scenario "successful report" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Technical fault with GOV.UK: content",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form technical_fault fault_with_gov_uk_content],
Expand Down
4 changes: 2 additions & 2 deletions spec/features/unpublish_content_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

scenario "request to unpublish in case of publishing error" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Published in error - Unpublish content request",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form unpublish_content published_in_error],
Expand All @@ -37,7 +37,7 @@
end

scenario "request to unpublish when page is a dupe" do
request = expect_zendesk_to_receive_ticket(
request = expect_support_api_to_receive_raise_ticket(
"subject" => "Duplicate of another page - Unpublish content request",
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"),
"tags" => %w[govt_form unpublish_content duplicate_publication],
Expand Down
13 changes: 3 additions & 10 deletions spec/support/gds_zendesk_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require "gds_zendesk/test_helpers"

module ZendeskRequestMockingExtensions
def expect_zendesk_to_receive_ticket(opts)
module SupportApiMockingExtensions
def expect_support_api_to_receive_raise_ticket(opts)
stub_support_api_valid_raise_support_ticket(hash_including(opts))
end

Expand All @@ -21,10 +19,5 @@ def stub_custom_fields_data(opts = [])
end

RSpec.configure do |c|
c.include GDSZendesk::TestHelpers
c.include ZendeskRequestMockingExtensions

c.before(:context) do
self.valid_zendesk_credentials = ZENDESK_CREDENTIALS
end
c.include SupportApiMockingExtensions
end
2 changes: 0 additions & 2 deletions spec/support/json_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "gds_zendesk/test_helpers"

# rubocop:disable Rails/HttpPositionalArguments
module JsonHelpers
def json_response
Expand Down

0 comments on commit 9750235

Please sign in to comment.