From 1cf04271c2e448b0952721ae6d06e79e17aeab32 Mon Sep 17 00:00:00 2001 From: Aga Dufrat Date: Fri, 13 Oct 2023 12:37:13 +0100 Subject: [PATCH 1/2] Remove "Content change request" suffix from the Zendesk ticket subject These ticket default to "Content Request" form so there's no need to add extra suffix to the subject. https://github.com/alphagov/support/commit/fdf8968f84231f2365207215e40cbaccad2fa6a1 --- app/models/zendesk/ticket/content_change_request_ticket.rb | 6 +----- spec/features/content_change_requests_spec.rb | 2 +- .../zendesk/ticket/content_change_request_ticket_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/models/zendesk/ticket/content_change_request_ticket.rb b/app/models/zendesk/ticket/content_change_request_ticket.rb index 755c00596..31e0c130d 100644 --- a/app/models/zendesk/ticket/content_change_request_ticket.rb +++ b/app/models/zendesk/ticket/content_change_request_ticket.rb @@ -4,11 +4,7 @@ class ContentChangeRequestTicket < Zendesk::ZendeskTicket TICKET_FORM_ID = 7_949_329_694_108 def subject - if @request.title.present? - "#{@request.title} - Content change request" - else - "Content change request" - end + @request.title.presence || "Content change request" end def tags diff --git a/spec/features/content_change_requests_spec.rb b/spec/features/content_change_requests_spec.rb index 6976579c7..237f05b42 100644 --- a/spec/features/content_change_requests_spec.rb +++ b/spec/features/content_change_requests_spec.rb @@ -15,7 +15,7 @@ scenario "successful mainstream content change request " do request = expect_zendesk_to_receive_ticket( - "subject" => "Update X - Content change request", + "subject" => "Update X", "requester" => hash_including("name" => "John Smith", "email" => "john.smith@agency.gov.uk"), "tags" => %w[govt_form content_amend], "comment" => { diff --git a/spec/models/zendesk/ticket/content_change_request_ticket_spec.rb b/spec/models/zendesk/ticket/content_change_request_ticket_spec.rb index 1250df257..061df418b 100644 --- a/spec/models/zendesk/ticket/content_change_request_ticket_spec.rb +++ b/spec/models/zendesk/ticket/content_change_request_ticket_spec.rb @@ -12,8 +12,8 @@ def with_time_constraint(attributes) { time_constraint: OpenStruct.new(attributes) } end - it "contains the title in the subject, if one is provided" do - expect(ticket(title: "Abc").subject).to eq("Abc - Content change request") + it "has the title in the subject, if one is provided" do + expect(ticket(title: "Abc").subject).to eq("Abc") end it "has a default subject" do From bcd9984967f70e5338b21455debb3ecd72684de3 Mon Sep 17 00:00:00 2001 From: Aga Dufrat Date: Fri, 13 Oct 2023 13:08:18 +0100 Subject: [PATCH 2/2] Temporarily add content request fields into the ticket body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is an issue with Zapier integration the content teams use to create Trello cards from Zendesk tickets. Deadlines/not-before dates aren’t pulling through on cards because this data is now in different fields. This was anticipated however colleagues with with login details to the Zapier account are not available today to make a change. We will temporally add this information to the ticket body so it's copied over to Trello with Zapier. Once Zapier is updated we can revert this commit. --- .../ticket/content_change_request_ticket.rb | 14 +++++++++++++ spec/features/content_change_requests_spec.rb | 20 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/models/zendesk/ticket/content_change_request_ticket.rb b/app/models/zendesk/ticket/content_change_request_ticket.rb index 31e0c130d..c4c5d8e50 100644 --- a/app/models/zendesk/ticket/content_change_request_ticket.rb +++ b/app/models/zendesk/ticket/content_change_request_ticket.rb @@ -28,6 +28,20 @@ def custom_fields def comment_snippets snippets = [ + Zendesk::LabelledSnippet.new( + on: @request, + field: :reason_for_change, + label: "Reason for request", + ), + Zendesk::LabelledSnippet.new( + on: @request, + field: :subject_area, + label: "Subject area", + ), + Zendesk::LabelledSnippet.new(on: self, field: :needed_by_date, label: "Deadline date"), + Zendesk::LabelledSnippet.new(on: self, field: :needed_by_time, label: "Deadline time"), + Zendesk::LabelledSnippet.new(on: self, field: :not_before_date, label: "Do not publish before date"), + Zendesk::LabelledSnippet.new(on: self, field: :not_before_time, label: "Do not publish before time"), Zendesk::LabelledSnippet.new( on: @request, field: :url, diff --git a/spec/features/content_change_requests_spec.rb b/spec/features/content_change_requests_spec.rb index 237f05b42..cde2cdf92 100644 --- a/spec/features/content_change_requests_spec.rb +++ b/spec/features/content_change_requests_spec.rb @@ -20,7 +20,25 @@ "tags" => %w[govt_form content_amend], "comment" => { "body" => -"[URLs to be changed] +"[Reason for request] +Factual inaccuracy + +[Subject area] +Benefits + +[Deadline date] +31-12-#{next_year} + +[Deadline time] +13:00 + +[Do not publish before date] +01-12-#{next_year} + +[Do not publish before time] +18:00 + +[URLs to be changed] http://gov.uk/X [Details of what should be added, amended or removed]