Skip to content

Commit

Permalink
Merge pull request #294 from CityOfNewYork/hotfix/OP-1343
Browse files Browse the repository at this point in the history
Hotfix/OP-1343: QA Fixes
  • Loading branch information
joelbcastillo authored Jan 9, 2018
2 parents cc9a5f1 + 1bd670d commit 0f15188
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
23 changes: 21 additions & 2 deletions app/response/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,27 @@ def _closing_email_handler(request_id, data, page, agency_name, email_template):
if content.endswith(TINYMCE_EDITABLE_P_TAG):
content = content[:-len(TINYMCE_EDITABLE_P_TAG)]
else:
reasons = [Reasons.query.filter_by(id=reason_id).one().content
for reason_id in data.getlist('reason_ids[]')]
_reasons = [Reasons.query.with_entities(Reasons.title, Reasons.content).filter_by(id=reason_id).one()
for reason_id in data.getlist('reason_ids[]')]

# Determine if a custom reason is used
# TODO: Hardcoded values; Need to figure out a better way to do this; Might be part of Agency Features at a later date.
custom_reasons = any('Denied - Reason Below' in x[0] for x in _reasons)

# In order to handle the custom logic for an empty denial reason, remove the reason from the list and pass in
# "custom_reasons" to the template so that the code is generated correctly.
if custom_reasons:
for reason in _reasons:
if reason[0] == 'Denied - Reason Below':
_reasons.remove(reason)
break

reasons = render_template(
os.path.join(current_app.config['EMAIL_TEMPLATE_DIR'], '_email_response_determinations_list.html'),
reasons=_reasons,
custom_reasons=custom_reasons
)

default_content = True
content = None
header = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
</ul>
</span>
{% if custom_reasons %}
<br/><br/>
<p><br/><br/></p>
{% endif %}
4 changes: 1 addition & 3 deletions app/templates/email_templates/email_response_closing.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
The {{ agency_name }} has <strong>closed</strong> your FOIL request <a href='{{ page }}'>{{ request.id }}</a>
for the following reason{% if reasons|length > 1 %}s{% endif %}:
</span>
{% for reason in reasons %}
<p><span class="mceNonEditable">&nbsp;&nbsp;&nbsp;{{ reason }}</span></p>
{% endfor %}
{{ reasons | safe }}
<span class="mceNonEditable">
You may appeal the decision to deny access to material that was redacted in part or withheld in entirety
by contacting the agency's FOIL Appeals Officer: <a
Expand Down

0 comments on commit 0f15188

Please sign in to comment.