-
Notifications
You must be signed in to change notification settings - Fork 18
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
Email the "contact us" form data instead of sending to Freshdesk for sensitive services #2416
Conversation
so it looks good to me while testing! The email gets sent, but the format of the email is a little off:
We should not be sending the |
app/dao/services_dao.py
Outdated
@@ -599,3 +599,8 @@ def dao_fetch_service_creator(service_id: uuid.UUID) -> User: | |||
def dao_fetch_service_ids_of_sensitive_services(): | |||
sensitive_service_ids = Service.query.filter(Service.sensitive_service.is_(True)).with_entities(Service.id).all() | |||
return [str(service_id) for (service_id,) in sensitive_service_ids] | |||
|
|||
|
|||
def dao_fetch_service_ids_of_pt_services(): |
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.
this is a short list for now, and this is a temporary feature - hence the below is a question not a request to change.
Would it make sense to take the email_address of the person -> get the service_ids the user is associated with? Instead of the larger list?
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.
Good point actually! We already have the organisation_type data for a user's services without doing an extra query. I've changed the code and removed the dao_fetch_service_ids_of_sensitive_services
fn.
We don't have the service_id since support requests are just tied to a user, not a specific service. The user_id and description are in there but the formatting is bad. It would be a tonne of work to improve the formatting, because I'm re-using this existing function that just spits out html: https://github.com/cds-snc/notification-api/blob/fix/send-sensitive-to-inbox/app/clients/freshdesk.py#L26-L97 That fn has a bunch of logic to include different data depending on the type of request. So I would have to duplicate all of that if I were going to include the same data as plain text in the template. |
@@ -480,6 +480,13 @@ def send_contact_request(user_id): | |||
except Exception as e: | |||
current_app.logger.exception(e) | |||
|
|||
# Check if user is member of any ptm services | |||
if current_app.config.get("FF_PT_SERVICE_SKIP_FRESHDESK", False) and user: | |||
if "province_or_territory" in [service.organisation_type for service in user.services]: |
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.
😍
Summary | Résumé
This PR does the following:
FF_PT_SERVICE_SKIP_FRESHDESK
) to switch this feature on and offRelated Issues | Cartes liées
Test instructions | Instructions pour tester la modification
poetry run flask db upgrade
Then switch the service to use a different organisation and try this flow again - the data should not be emailed and it should be sent to Freshdesk (if you have the credentials for that set locally)
Release Instructions | Instructions pour le déploiement
We will need to add
FF_PT_SERVICE_SKIP_FRESHDESK
to notification-manifests.Reviewer checklist | Liste de vérification du réviseur