-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into pinpoint-for-everyone
- Loading branch information
Showing
12 changed files
with
124 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
""" | ||
Revision ID: 0448_update_verify_code2 | ||
Revises: 0449_update_magic_link_auth | ||
Create Date: 2023-10-05 00:00:00 | ||
""" | ||
from datetime import datetime | ||
|
||
from alembic import op | ||
from flask import current_app | ||
|
||
revision = "0449_update_magic_link_auth" | ||
down_revision = "0448_update_verify_code2" | ||
|
||
near_content = "\n".join( | ||
[ | ||
"[[en]]" | ||
"Hi ((name))," | ||
"" | ||
"Here is your magic link to log in to GC Notify:" | ||
"" | ||
"^ **[Sign-in](((link_url_en)))**" | ||
"[[/en]]" | ||
"" | ||
"---" | ||
"" | ||
"[[fr]]" | ||
"Bonjour ((name))," | ||
"" | ||
"Voici votre lien magique pour vous connecter à Notification GC:" | ||
"" | ||
"^ **[Connectez-vous](((link_url_fr)))**" | ||
"[[/fr]]" | ||
] | ||
) | ||
|
||
|
||
template = { | ||
"id": current_app.config["EMAIL_MAGIC_LINK_TEMPLATE_ID"], | ||
"template_type": "email", | ||
"subject": "Sign in | Connectez-vous", | ||
"content": near_content, | ||
"process_type": "priority", | ||
"name": "Sign in - Magic Link | Se connecter - Lien magique", | ||
} | ||
|
||
|
||
def upgrade(): | ||
conn = op.get_bind() | ||
|
||
template_insert = """ | ||
INSERT INTO templates (id, name, template_type, created_at, updated_at, content, service_id, subject, created_by_id, version, archived, process_type, hidden) | ||
VALUES ('{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', false, '{}', false) | ||
""" | ||
|
||
template_history_insert = """ | ||
INSERT INTO templates_history (id, name, template_type, created_at, content, archived, service_id, subject, | ||
created_by_id, version, process_type, hidden) | ||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', {}, '{}', false) | ||
""" | ||
op.execute( | ||
template_insert.format( | ||
template["id"], | ||
template["name"], | ||
template["template_type"], | ||
datetime.utcnow(), | ||
datetime.utcnow(), | ||
template["content"], | ||
current_app.config["NOTIFY_SERVICE_ID"], | ||
template["subject"], | ||
current_app.config["NOTIFY_USER_ID"], | ||
1, | ||
template["process_type"], | ||
) | ||
) | ||
|
||
op.execute( | ||
template_history_insert.format( | ||
template["id"], | ||
template["name"], | ||
template["template_type"], | ||
datetime.utcnow(), | ||
template["content"], | ||
current_app.config["NOTIFY_SERVICE_ID"], | ||
template["subject"], | ||
current_app.config["NOTIFY_USER_ID"], | ||
1, | ||
template["process_type"], | ||
) | ||
) | ||
|
||
op.execute("INSERT INTO auth_type (name) VALUES ('magic_link')") | ||
|
||
|
||
def downgrade(): | ||
op.execute("DELETE FROM auth_type WHERE name = 'magic_link'") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,13 +130,19 @@ def match_json(request): | |
"- Organisation id: 6b72e84f-8591-42e1-93b8-7d24a45e1d79<br>" | ||
"- Organisation name: best org name ever<br>" | ||
"- Logo filename: branding_url<br>" | ||
"- Logo name: branding_logo_name<br>" | ||
"- Alt text english: en alt text<br>" | ||
"- Alt text french: fr alt text<br>" | ||
"<hr><br>" | ||
"Un nouveau logo a été téléchargé par name ([email protected]) pour le service suivant :<br>" | ||
"- Identifiant du service : 8624bd36-b70b-4d4b-a459-13e1f4770b92<br>" | ||
"- Nom du service : t6<br>" | ||
"- Identifiant de l'organisation: 6b72e84f-8591-42e1-93b8-7d24a45e1d79<br>" | ||
"- Nom de l'organisation: best org name ever<br>" | ||
"- Nom du fichier du logo : branding_url", | ||
"- Nom du fichier du logo : branding_url<br>" | ||
"- Nom du logo : branding_logo_name<br>" | ||
"- Texte alternatif anglais : en alt text<br>" | ||
"- Texte alternatif français : fr alt text", | ||
"email": "[email protected]", | ||
"priority": 1, | ||
"status": 2, | ||
|
@@ -166,6 +172,9 @@ def match_json(request): | |
"department_org_name": "best org name ever", | ||
"service_id": "8624bd36-b70b-4d4b-a459-13e1f4770b92", | ||
"branding_url": "branding_url", | ||
"branding_logo_name": "branding_logo_name", | ||
"alt_text_en": "en alt text", | ||
"alt_text_fr": "fr alt text", | ||
} | ||
with notify_api.app_context(): | ||
response = freshdesk.Freshdesk(ContactRequest(**data)).send_ticket() | ||
|