mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 18:37:33 -04:00
Let users send inbound emoji
Implements: - [ ] https://github.com/alphagov/notifications-utils/pull/167 Required some refactoring to be able to defined the `is_inbound` variable.
This commit is contained in:
@@ -33,23 +33,23 @@ def get_user_number(service_id, notification_id):
|
|||||||
|
|
||||||
|
|
||||||
def get_sms_thread(service_id, user_number):
|
def get_sms_thread(service_id, user_number):
|
||||||
return [
|
|
||||||
{
|
for notification in sorted((
|
||||||
'inbound': ('notify_number' in notification),
|
notification_api_client.get_notifications_for_service(service_id, to=user_number)['notifications'] +
|
||||||
|
service_api_client.get_inbound_sms(service_id, user_number=user_number)
|
||||||
|
), key=lambda notification: notification['created_at']):
|
||||||
|
|
||||||
|
is_inbound = ('notify_number' in notification)
|
||||||
|
|
||||||
|
yield {
|
||||||
|
'inbound': is_inbound,
|
||||||
'content': SMSPreviewTemplate(
|
'content': SMSPreviewTemplate(
|
||||||
{
|
{
|
||||||
'content': notification.get('content') or notification['template']['content']
|
'content': notification.get('content') or notification['template']['content']
|
||||||
}
|
},
|
||||||
|
downgrade_non_gsm_characters=(not is_inbound)
|
||||||
),
|
),
|
||||||
'created_at': notification['created_at'],
|
'created_at': notification['created_at'],
|
||||||
'status': notification.get('status'),
|
'status': notification.get('status'),
|
||||||
'id': notification['id'],
|
'id': notification['id'],
|
||||||
}
|
}
|
||||||
for notification in sorted(
|
|
||||||
(
|
|
||||||
notification_api_client.get_notifications_for_service(service_id, to=user_number)['notifications'] +
|
|
||||||
service_api_client.get_inbound_sms(service_id, user_number=user_number)
|
|
||||||
),
|
|
||||||
key=lambda notification: notification['created_at'],
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|||||||
+1
-1
@@ -28,4 +28,4 @@ notifications-python-client>=3.1,<3.2
|
|||||||
awscli>=1.11,<1.12
|
awscli>=1.11,<1.12
|
||||||
awscli-cwlogs>=1.4,<1.5
|
awscli-cwlogs>=1.4,<1.5
|
||||||
|
|
||||||
git+https://github.com/alphagov/notifications-utils.git@17.2.0#egg=notifications-utils==17.2.0
|
git+https://github.com/alphagov/notifications-utils.git@17.3.0#egg=notifications-utils==17.3.0
|
||||||
|
|||||||
@@ -76,8 +76,6 @@ def test_view_conversation(
|
|||||||
expected,
|
expected,
|
||||||
):
|
):
|
||||||
|
|
||||||
print(index)
|
|
||||||
|
|
||||||
response = logged_in_client.get(url_for(
|
response = logged_in_client.get(url_for(
|
||||||
'main.conversation',
|
'main.conversation',
|
||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
@@ -89,9 +87,8 @@ def test_view_conversation(
|
|||||||
messages = page.select('.sms-message-wrapper')
|
messages = page.select('.sms-message-wrapper')
|
||||||
statuses = page.select('.sms-message-status')
|
statuses = page.select('.sms-message-status')
|
||||||
|
|
||||||
for elements in (messages, statuses):
|
assert len(messages) == 13
|
||||||
assert len(elements) == 13
|
assert len(statuses) == 13
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
normalize_spaces(messages[index].text),
|
normalize_spaces(messages[index].text),
|
||||||
normalize_spaces(statuses[index].text),
|
normalize_spaces(statuses[index].text),
|
||||||
|
|||||||
Reference in New Issue
Block a user