gitlab_support_readiness 1.0.63 → 1.0.65

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: e1e57174c750ee75156bc2a08ce18e44cb04cb5a9013362f1191e5d98f96cd87
4
- data.tar.gz: '08344544702bc9135a6fe7566263d1c3a41fcc45fe821e2b1b887800ab196d20'
3
+ metadata.gz: 7b7912aaaceff61c5330ff68593cdb3d02b885234628735b6e021df027290b10
4
+ data.tar.gz: d6917d2e6e7d9df2df7e6583af3160cdf46782d0d223ef9502ad8efece2f2a5b
5
5
  SHA512:
6
- metadata.gz: 4749188c898198a2e94a2e0c4cf565d13c634d22f6b7796882beb931fac9e7ea5ec6e777d3958723805a7d7ac29050491415791a0b169e06931fab0830297bb3
7
- data.tar.gz: f44809e58873b9128762eff888312ddeb54e33e86dd697085aba7f37f2d03afe90f4670adb0218dfad20315a7dc34ebbe8ead384b79bdf4d9114d7291e7a81c5
6
+ metadata.gz: ed0d01911c128ee9eb52a814a055e107322816b42041035aabe3ad6d33f21c87b39178d472105a37034143554e90e6d5a01bd0f1a823d2162f29c8c6baaecafd
7
+ data.tar.gz: '0079272673ae45ce6a8cc899ec621d316b001938fcea7373fd33c64e247cf6c5ab9a9fb7cef024e803715a5580aa8044889db3f720cb61ff979bcd331b23948b'
@@ -1068,10 +1068,7 @@ module Readiness
1068
1068
  end
1069
1069
 
1070
1070
  def self.sfdc_links(sfdc_id)
1071
- [
1072
- "<https://gitlab.my.salesforce.com/#{sfdc_id}|Classic>",
1073
- "<https://gitlab.lightning.force.com/lightning/r/Account/#{sfdc_id}/view|Lightning>"
1074
- ].join(' | ')
1071
+ "<https://gitlab.lightning.force.com/lightning/r/Account/#{sfdc_id}/view|#{sfdc_id}>"
1075
1072
  end
1076
1073
 
1077
1074
  def self.global_slack_message(org)
@@ -216,8 +216,8 @@ module Readiness
216
216
  A request has been filed to enable US Government Support for a SFDC account. The details are as follows:
217
217
 
218
218
  - Requester: @#{requester.username}
219
- - SFDC Account: [#{account.Account_ID_18__c}](https://gitlab.my.salesforce.com/#{account.Account_ID_18__c})
220
- - SFDC Opportunity: [#{opportunity.Account_ID_18__c}](https://gitlab.my.salesforce.com/#{opportunity.Account_ID_18__c})
219
+ - SFDC Account: [#{account.Account_ID_18__c}](https://gitlab.lightning.force.com/lightning/r/Account/#{account.Account_ID_18__c}/view)
220
+ - SFDC Opportunity: [#{opportunity.Id}](https://gitlab.lightning.force.com/lightning/r/Opportunity/#{opportunity.Id}/view)
221
221
  - Product Charges on SFDC account:
222
222
  #{account.Zuora__R00N40000001lGjTEAU__r.map { |r| " - #{r.Name}" }.join("\n")}
223
223
 
@@ -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,15 +486,38 @@ 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]
476
516
  else
477
517
  link.split('/').last
478
518
  end
479
- classic = "<a href='https://gitlab.my.salesforce.com/#{id}' target='_blank'>Classic</a>"
480
- lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/Account/#{id}/view' target='_blank'>Lightning</a>"
481
- "SFDC Account: #{id} (#{classic} | #{lightning})"
519
+ lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/Account/#{id}/view' target='_blank'>#{id}</a>"
520
+ "SFDC Account: #{lightning}"
482
521
  end
483
522
 
484
523
  def self.sfdc_opportunity_string(link)
@@ -487,9 +526,8 @@ module Readiness
487
526
  else
488
527
  link.split('/').last
489
528
  end
490
- classic = "<a href='https://gitlab.my.salesforce.com/#{id}' target='_blank'>Classic</a>"
491
- lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/Opportunity/#{id}/view' target='_blank'>Lightning</a>"
492
- "SFDC Opportunity: #{id} (#{classic} | #{lightning})"
529
+ lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/Opportunity/#{id}/view' target='_blank'>#{id}</a>"
530
+ "SFDC Opportunity: #{lightning}"
493
531
  end
494
532
 
495
533
  def self.sfdc_upload_string(link)
@@ -498,9 +536,8 @@ module Readiness
498
536
  else
499
537
  link.split('/').last
500
538
  end
501
- classic = "<a href='https://gitlab.my.salesforce.com/#{id}' target='_blank'>Classic</a>"
502
- lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/ContentDocument/#{id}/view' target='_blank'>Lightning</a>"
503
- "Customer verification proof: #{id} (#{classic} | #{lightning})"
539
+ lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/ContentDocument/#{id}/view' target='_blank'>#{id}</a>"
540
+ "Customer verification proof: #{lightning}"
504
541
  end
505
542
 
506
543
  def self.sfdc_chattr_string(link)
@@ -509,9 +546,8 @@ module Readiness
509
546
  else
510
547
  link.split('/').last
511
548
  end
512
- classic = "<a href='https://gitlab.my.salesforce.com/#{id}' target='_blank'>Classic</a>"
513
- lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/#{id}/view' target='_blank'>Lightning</a>"
514
- "Chattr link containing approval: #{id} (#{classic} | #{lightning})"
549
+ lightning = "<a href='https://gitlab.lightning.force.com/lightning/r/#{id}/view' target='_blank'>#{id}</a>"
550
+ "Chattr link containing approval: #{lightning}"
515
551
  end
516
552
  end
517
553
  end
@@ -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.63
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