gitlab_support_readiness 1.0.64 → 1.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37103ba6b2b5b0da5927de56d8b8c5af2340d9db6e00f19df569f909efcb8734
4
- data.tar.gz: c7eb9093306155290df97a2609d531767dccc079ddacebf94c2ac05259287bb8
3
+ metadata.gz: 7b7912aaaceff61c5330ff68593cdb3d02b885234628735b6e021df027290b10
4
+ data.tar.gz: d6917d2e6e7d9df2df7e6583af3160cdf46782d0d223ef9502ad8efece2f2a5b
5
5
  SHA512:
6
- metadata.gz: 2e3e09c09efaa56732fb6f48ebddadb70964d3315e8d3bb88643b5b63319806b9b12d87f545d14d94cbbcb31570d4d4952c159b0d9eb7100a4434667a8c82240
7
- data.tar.gz: bdd10f86a80025a655bd96065ffde08cba5c42afcd7f31cac317b413c97f22c32f60c2771028b159b1f20f83d803f8668780bef42caa07c0a6cad117522e026d
6
+ metadata.gz: ed0d01911c128ee9eb52a814a055e107322816b42041035aabe3ad6d33f21c87b39178d472105a37034143554e90e6d5a01bd0f1a823d2162f29c8c6baaecafd
7
+ data.tar.gz: '0079272673ae45ce6a8cc899ec621d316b001938fcea7373fd33c64e247cf6c5ab9a9fb7cef024e803715a5580aa8044889db3f720cb61ff979bcd331b23948b'
@@ -137,6 +137,9 @@ module Readiness
137
137
  query = Readiness::Salesforce::Queries.new(opportunity_query)
138
138
  results = Readiness::Salesforce::Queries.run!(@sfdc_client, query)
139
139
  results.first
140
+ rescue Restforce::ErrorCode::InvalidQueryFilterOperator
141
+ puts 'Invalid SFDC opp link provided'
142
+ Readiness::SupportSuperFormProcessor::Shared.invalid_opportunity_link(requester, opportunity_link)
140
143
  end
141
144
 
142
145
  ##
@@ -206,6 +206,22 @@ module Readiness
206
206
  exit 0
207
207
  end
208
208
 
209
+ ##
210
+ # Sends an email if not a valid opportunity link for a gratis request
211
+ #
212
+ # @author Jason Colyer
213
+ # @since 1.0.65
214
+ def self.invalid_opportunity_link(requester, opportunity_link)
215
+ email = Readiness::Mailgun::Emails.new
216
+ email.from = 'GitLab Support <techsupport@gitlab.com>'
217
+ email.to = requester.email
218
+ email.subject = 'Invalid Support Super Form submission'
219
+ email.text = invalid_opportunity_link_message(requester, opportunity_link)
220
+ Readiness::Mailgun::Emails.send!(mailgun_client, email)
221
+ puts "Invalid opportunity link provided for gratis request by #{requester.email}"
222
+ exit 0
223
+ end
224
+
209
225
  ##
210
226
  # Sets a global variable for an instance of {Readiness::Mailgun::Client}
211
227
  #
@@ -470,6 +486,30 @@ module Readiness
470
486
  STRING
471
487
  end
472
488
 
489
+ ##
490
+ # Returns the email body message when not a valid SFDC opportunity link for gratis requests
491
+ #
492
+ # @author Jason Colyer
493
+ # @since 1.0.65
494
+ # @return [String]
495
+ def self.invalid_opportunity_link_message(requester, opportunity_link)
496
+ <<~STRING
497
+ Greetings @#{requester.username} ,
498
+
499
+ Your recent gratis request was not able to be filed due to the following issues:
500
+
501
+ - Invalid SFDC opportunity link provided: #{opportunity_link}
502
+
503
+ Please rectify the above issues and re-submit your request via the form.
504
+
505
+ Thank you,
506
+
507
+ GitLab Support
508
+
509
+ Please note this is sent from an unmonitored inbox and replies to it will not be followed up on.
510
+ STRING
511
+ end
512
+
473
513
  def self.sfdc_account_string(link)
474
514
  id = if link =~ /lightning/
475
515
  link.split('/')[-2]
@@ -25,8 +25,10 @@ module Readiness
25
25
  exit 0 if @ticket.is_a? Hash
26
26
 
27
27
  email = @ticket.custom_fields.detect { |t| t['id'] == 4413932829586 }['value']
28
- puts 'No email in the field, so nothing to autowork' if email.to_s = ''
29
- exit 0 if email.to_s = ''
28
+ if email.to_s == ''
29
+ puts 'No email in the field, so nothing to autowork'
30
+ exit 0
31
+ end
30
32
 
31
33
  search = Readiness::GitLab::Users.search_by_email(@gitlab_admin_client, email)
32
34
  @user = search.detect { |s| s.email.downcase == email.downcase }
@@ -31,6 +31,19 @@ module Readiness
31
31
  comments = Readiness::Zendesk::Tickets.comments(@zendesk_client, @ticket)
32
32
  public_comments = comments.select { |c| c['public'] }
33
33
  comment_to_check = public_comments.select { |c| c['author_id'] == @user.id }.last
34
+ if comment_to_check.nil?
35
+ public_comments.reverse.each do |comment|
36
+ new_user = Readiness::Zendesk::Users.find(@zendesk_client, comment['author_id'])
37
+ next unless %w[admin agent].include? new_user.role
38
+
39
+ comment_to_check = comment
40
+ break
41
+ end
42
+ end
43
+ if comment_to_check.nil?
44
+ puts 'Cannot determine a comment to check, so exiting...'
45
+ exit 0
46
+ end
34
47
  tags_to_add = []
35
48
  Nokogiri::HTML(comment_to_check['html_body']).css('a').each do |p|
36
49
  link = p['href'].split('?').first.split('#').first
@@ -22,7 +22,7 @@ module Readiness
22
22
  puts 'No ticket found, so no org notes to add' if @ticket.is_a? Hash
23
23
  exit 0 if @ticket.is_a? Hash
24
24
 
25
- puts 'Ticket is closed, so no org notes to add' if @ticket.status == 'closed'
25
+ puts 'Ticket is closed, so ticket to process' if @ticket.status == 'closed'
26
26
  exit 0 if @ticket.status == 'closed'
27
27
 
28
28
  new_ticket = Readiness::Zendesk::Tickets.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_support_readiness
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.64
4
+ version: 1.0.65
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Colyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
11
+ date: 2024-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport