Class: Readiness::TicketProcessor::EmailSuppressions
- Inherits:
-
Client
- Object
- Client
- Readiness::TicketProcessor::EmailSuppressions
show all
- Defined in:
- lib/support_readiness/ticket_processor/email_suppressions.rb
Overview
Defines the class EmailSuppressions within the module Zendesk.
Class Method Summary
collapse
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Class Method Details
.no_bounce_exists ⇒ Object
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/support_readiness/ticket_processor/email_suppressions.rb', line 65
def self.no_bounce_exists
new_ticket = Readiness::Zendesk::Tickets.new
new_ticket.id = @ticket.id
new_ticket.status = 'pending'
new_ticket. = { body: }
new_ticket.custom_fields = [
{ id: @ticket_stage_field.id, value: 'stage-frt' }
]
Readiness::Zendesk::Tickets.update!(@zendesk_client, new_ticket)
end
|
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/support_readiness/ticket_processor/email_suppressions.rb', line 92
def self.
<<~STRING
Greetings,
We have checked our systems and have not located any suppressions at this time for your email address (#{@email}). We would recommend checking your spam folder or contacting your email provider to help in locating any recent emails from us you may have received or requested.
Some common links you might need to get a new email are:
- Request a new confirmation email via https://gitlab.com/users/confirmation/new
- Request a new verification challenge by logging into GitLab.com directly and using the link in the prompt.
- Request a password reset on gitlab.com via https://gitlab.com/users/password/new
STRING
end
|
.no_email_given ⇒ Object
55
56
57
58
59
60
61
62
63
|
# File 'lib/support_readiness/ticket_processor/email_suppressions.rb', line 55
def self.no_email_given
new_ticket = Readiness::Zendesk::Tickets.new
new_ticket.id = @ticket.id
new_ticket. = { body: , public: false }
new_ticket.custom_fields = [
{ id: @ticket_stage_field.id, value: 'stage-frt' }
]
Readiness::Zendesk::Tickets.update!(@zendesk_client, new_ticket)
end
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/support_readiness/ticket_processor/email_suppressions.rb', line 76
def self.
<<~STRING
We were unable to check for email suppressions on this ticket as the value of the `Impacted email address` is blank.
Please do the following to correct this and have this ticket re-autoworked:
- Please review the ticket and correct the field 'Impacted email address' to have a valid value
- Remove any of the following tags:
- `autowork_no_confirmation_email`
- `autowork_forgot_password`
- `autowork_notification_emails`
Make sure to save the update on the ticket. This should re-trigger the autowork script for you.
STRING
end
|
.process!(zendesk_client, mailgun_client, ticket_id) ⇒ Object
Process an Email Suppression request
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/support_readiness/ticket_processor/email_suppressions.rb', line 18
def self.process!(zendesk_client, mailgun_client, ticket_id)
@zendesk_client = zendesk_client
@mailgun_client = mailgun_client
@ticket_id = ticket_id
@ticket = Readiness::Zendesk::Tickets.find(@zendesk_client, @ticket_id)
puts 'No ticket found, so no org notes to add' if @ticket.is_a? Hash
exit 0 if @ticket.is_a? Hash
puts 'Ticket is closed, so no org notes to add' if @ticket.status == 'closed'
exit 0 if @ticket.status == 'closed'
@ticket_fields = Readiness::Zendesk::TicketFields.list(@zendesk_client)
@impacted_email_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Impacted email address', @ticket_fields)
@ticket_stage_field = Readiness::Zendesk::TicketFields.find_by_name(@zendesk_client, 'Ticket Stage', @ticket_fields)
@email = @ticket.custom_fields.detect { |t| t['id'] == @impacted_email_field.id }['value']
return no_email_given if @email.nil?
bounce = Readiness::Mailgun::Bounces.find(@mailgun_client, @email)
if bounce.address.nil?
no_bounce_exists
else
Readiness::Mailgun::Bounces.delete!(@mailgun_client, bounce)
new_ticket = Readiness::Zendesk::Tickets.new
new_ticket.id = @ticket.id
new_ticket. = { body: suppression_removed_note(bounce), public: false }
Readiness::Zendesk::Tickets.update!(@zendesk_client, new_ticket)
new_ticket = Readiness::Zendesk::Tickets.new
new_ticket.id = @ticket.id
new_ticket.status = 'solved'
new_ticket. = { body: , public: true }
new_ticket.custom_fields = [
{ id: @ticket_stage_field.id, value: 'stage-frt' }
]
Readiness::Zendesk::Tickets.update!(@zendesk_client, new_ticket)
end
end
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/support_readiness/ticket_processor/email_suppressions.rb', line 117
def self.
<<~STRING
Greetings,
It looks like a suppression had been placed in our system on your email address (#{@email}) for gitlab.com emails, so no further emails from that system would have reached you.
We have cleared that suppression for you at this time.
Some common links you might need to get a new email are:
- Request a new confirmation email via https://gitlab.com/users/confirmation/new
- Request a new verification challenge by logging into GitLab.com directly and using the link in the prompt.
- Request a password reset on gitlab.com via https://gitlab.com/users/password/new
With the removal of the suppression, this ticket has been marked as solved.
If the suppression removal did not solve the problem and you are still not receiving emails from gitlab.com, please reply to this email to reopen the ticket and alert GitLab Support.
STRING
end
|
.suppression_removed_note(bounce) ⇒ Object
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/support_readiness/ticket_processor/email_suppressions.rb', line 106
def self.suppression_removed_note(bounce)
<<~STRING
Suppression found and removed in mg.gitlab.com:
- Email: #{bounce.address}
- Code: #{bounce.code}
- Error: #{bounce.error}
- Time: #{bounce.created_at}
STRING
end
|