-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
send freshdesk api #1896
send freshdesk api #1896
Conversation
🧪 Review environmenthttps://ctheo5oqmgd7q5wcypxrkyvevi0qcynm.lambda-url.ca-central-1.on.aws/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question about the placement of the ticket creation in edit_service_template
, and I think it would be good to update the tests to ensure send_new_template_category_request()
is called as appropriate during template creation and template editing.
app/main/views/templates.py
Outdated
|
||
# Send the information in form's template_category_other field to Freshdesk | ||
# This code path is a little complex - We do not want to raise an error if the request to Freshdesk fails, only if template creation fails | ||
|
||
if form.template_category_other.data: | ||
is_english = get_current_locale(current_app) == "en" | ||
try: | ||
current_user.send_new_template_category_request( | ||
current_user.id, | ||
current_service.id, | ||
form.template_category_other.data if is_english else None, | ||
form.template_category_other.data if not is_english else None, | ||
new_template.id, | ||
) | ||
except HTTPError as e: | ||
current_app.logger.error( | ||
f"Failed to send new template category request to Freshdesk: {e} for template {new_template.id}, data is {form.template_category_other.data}" | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code should be down near service_api_client.update_service_template()
on line 984. As-is I think there is a chance this is going to send the request when a user is previewing their template.
app/main/views/templates.py
Outdated
# Send the information in form's template_category_other field to Freshdesk | ||
if form.template_category_other.data: | ||
is_english = get_current_locale(current_app) == "en" | ||
try: | ||
current_user.send_new_template_category_request( | ||
current_user.id, | ||
current_service.id, | ||
form.template_category_other.data if is_english else None, | ||
form.template_category_other.data if not is_english else None, | ||
new_template.id, | ||
) | ||
except HTTPError as e: | ||
current_app.logger.error( | ||
f"Failed to send new template category request to Freshdesk: {e} for template {new_template.id}, data is {form.template_category_other.data}" | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be here, again?
4ad18c6
to
33ec66a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Tested locally and behaves as expected!
Summary | Résumé
If the template creation/ edit form has data in the Other field - We will send that data to freshdesk
Test instructions | Instructions pour tester la modification
Unfortunately we don't have a freshdesk integration for staging. The code is try/ except blocks for this exact reason.