mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Merge branch 'master' into inbound-sms
Conflicts: app/notifications/receive_notifications.py tests/app/notifications/test_receive_notification.py
This commit is contained in:
@@ -3,6 +3,7 @@ from datetime import date, datetime, timedelta
|
||||
|
||||
from sqlalchemy import asc, func
|
||||
from sqlalchemy.orm import joinedload
|
||||
from flask import current_app
|
||||
|
||||
from app import db
|
||||
from app.dao.dao_utils import (
|
||||
@@ -137,6 +138,12 @@ def dao_fetch_service_by_id_and_user(service_id, user_id):
|
||||
@transactional
|
||||
@version_class(Service)
|
||||
def dao_create_service(service, user, service_id=None, service_permissions=[SMS_TYPE, EMAIL_TYPE]):
|
||||
# the default property does not appear to work when there is a difference between the sqlalchemy schema and the
|
||||
# db schema (ie: during a migration), so we have to set sms_sender manually here. After the GOVUK sms_sender
|
||||
# migration is completed, this code should be able to be removed.
|
||||
if not service.sms_sender:
|
||||
service.sms_sender = current_app.config['FROM_NUMBER']
|
||||
|
||||
from app.dao.permissions_dao import permission_dao
|
||||
service.users.append(user)
|
||||
permission_dao.add_default_service_permissions_for_user(user, service)
|
||||
|
||||
Reference in New Issue
Block a user