mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
Merge pull request #1657 from alphagov/fix-template-versions
Fix template version for admin app
This commit is contained in:
@@ -347,6 +347,7 @@ class TemplateSchema(BaseTemplateSchema):
|
|||||||
class TemplateHistorySchema(BaseSchema):
|
class TemplateHistorySchema(BaseSchema):
|
||||||
|
|
||||||
reply_to = fields.Method("get_reply_to", allow_none=True)
|
reply_to = fields.Method("get_reply_to", allow_none=True)
|
||||||
|
reply_to_text = fields.Method("get_reply_to_text", allow_none=True)
|
||||||
|
|
||||||
created_by = fields.Nested(UserSchema, only=['id', 'name', 'email_address'], dump_only=True)
|
created_by = fields.Nested(UserSchema, only=['id', 'name', 'email_address'], dump_only=True)
|
||||||
created_at = field_for(models.Template, 'created_at', format='%Y-%m-%d %H:%M:%S.%f')
|
created_at = field_for(models.Template, 'created_at', format='%Y-%m-%d %H:%M:%S.%f')
|
||||||
@@ -354,6 +355,9 @@ class TemplateHistorySchema(BaseSchema):
|
|||||||
def get_reply_to(self, template):
|
def get_reply_to(self, template):
|
||||||
return template.reply_to
|
return template.reply_to
|
||||||
|
|
||||||
|
def get_reply_to_text(self, template):
|
||||||
|
return template.get_reply_to_text()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.TemplateHistory
|
model = models.TemplateHistory
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
Revision ID: 0164_add_organisation_service
|
Revision ID: 0164_add_organisation_to_service
|
||||||
Revises: 0163_add_new_org_model
|
Revises: 0163_add_new_org_model
|
||||||
Create Date: 2018-02-09 17:58:34.617206
|
Create Date: 2018-02-09 17:58:34.617206
|
||||||
|
|
||||||
@@ -112,3 +112,4 @@ def test_update_template_reply_to_updates_history(client, sample_letter_template
|
|||||||
hist_json_resp = json.loads(resp.get_data(as_text=True))
|
hist_json_resp = json.loads(resp.get_data(as_text=True))
|
||||||
assert 'service_letter_contact_id' not in hist_json_resp['data']
|
assert 'service_letter_contact_id' not in hist_json_resp['data']
|
||||||
assert hist_json_resp['data']['reply_to'] == str(letter_contact.id)
|
assert hist_json_resp['data']['reply_to'] == str(letter_contact.id)
|
||||||
|
assert hist_json_resp['data']['reply_to_text'] == letter_contact.contact_block
|
||||||
|
|||||||
Reference in New Issue
Block a user