gitlab_support_readiness 1.0.64 → 1.0.66

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37103ba6b2b5b0da5927de56d8b8c5af2340d9db6e00f19df569f909efcb8734
4
- data.tar.gz: c7eb9093306155290df97a2609d531767dccc079ddacebf94c2ac05259287bb8
3
+ metadata.gz: 555e87ceef9f70d14577d0c9d419f56648f3cfad7e4e177169970b041937d2c9
4
+ data.tar.gz: 5bc0fc6ddd09c51732523a7d33265500d9ee11b3231a09a8697eec2f22f3cd5e
5
5
  SHA512:
6
- metadata.gz: 2e3e09c09efaa56732fb6f48ebddadb70964d3315e8d3bb88643b5b63319806b9b12d87f545d14d94cbbcb31570d4d4952c159b0d9eb7100a4434667a8c82240
7
- data.tar.gz: bdd10f86a80025a655bd96065ffde08cba5c42afcd7f31cac317b413c97f22c32f60c2771028b159b1f20f83d803f8668780bef42caa07c0a6cad117522e026d
6
+ metadata.gz: 9bc0544b8ac79a53e228879be0c736746cf01fe095f4ab1d8a84ec0a82e4222f01c799fa463bb986d79f978d987246ce81762dc940f3259086a0572c6c0da6f5
7
+ data.tar.gz: 4c4aaf705453f395ad3a32bf4e6de36ab1cfb23b755568e85e22743bfe07d414da119d45523abab573b37959b21be8a82e6daa1c61acd6e12dff126e0041cc4f
@@ -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 }
@@ -92,7 +94,7 @@ module Readiness
92
94
  issue = Readiness::GitLab::Issues.new
93
95
  issue.title = "Account Reinstatement - #{@user.username}"
94
96
  issue.description = blocked_issue_body
95
- created = Readiness::GitLab::Issues.create!(@gitlab_client, issue)
97
+ created = Readiness::GitLab::Issues.create!(@gitlab_client, project, issue)
96
98
  puts 'done'
97
99
  print 'Updating ticket...'
98
100
 
@@ -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.66
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