Hide ID when only one reply to address is shown

Most user will only have one reply to address. Which means they should
never have to worry about IDs. And if you only have one then you never
need its ID, because the last remaining address will always be the
default.

So IDs should only be shown when a service has created more than one
reply to address.

This required a bit of visual tweaking of the _user list_ pattern,
because its spacing wasn’t defined in a way that worked when only the
name of the thing, and not its details were shown on the page.
This commit is contained in:
Chris Hill-Scott
2017-09-28 11:35:52 +01:00
parent c78fac911a
commit c35088796a
3 changed files with 20 additions and 3 deletions

View File

@@ -42,12 +42,12 @@
&-list {
@extend %grid-row;
margin-top: 5px;
position: relative;
&-permissions {
@include grid-column(3/4);
margin-top: 5px;
li {
display: block;
@@ -59,7 +59,7 @@
&-edit-link {
text-align: right;
position: absolute;
top: -1.6em;
top: -25px;
right: -135px;
}

View File

@@ -39,7 +39,9 @@
<a href="{{ url_for('.service_edit_email_reply_to', service_id =current_service.id, reply_to_email_id = item.id) }}">Change</a>
</li>
</ul>
{{ api_key(item.id, thing="ID") }}
{% if reply_to_email_addresses|length > 1 %}
{{ api_key(item.id, thing="ID") }}
{% endif %}
</div>
{% endfor %}
</div>

View File

@@ -689,6 +689,21 @@ def test_reply_to_hint_appears_when_service_has_multiple_reply_to_addresses(
) == "Email reply to addresses test@example.com …and 2 more Manage"
def test_single_reply_to_address_shows_default_but_without_id(
client_request,
single_reply_to_email_addresses
):
rows = client_request.get(
'main.service_email_reply_to',
service_id=SERVICE_ONE_ID
).select(
'.user-list-item'
)
assert normalize_spaces(rows[0].text) == "test@example.com (default) Change"
assert len(rows) == 1
def test_default_email_reply_to_address_has_default_hint(
client_request,
multiple_reply_to_email_addresses