discourse/app/assets/javascripts/admin/templates/modal/admin-badge-preview.hbs
Joffrey JAFFEUX 6102c287f7
FIX: prevents i18n helper to return a SafeString (#9191)
For convenience the i18n helper has been made returning a SafeString, but when used with other helpers, a String is expected and will cause unexpected behaviors.

This is the root cause of the initial bug fixed in d2bb127e2c

This commit is kept as it's a better security in case of unexpected behavior.
2020-03-12 16:50:20 +01:00

56 lines
1.5 KiB
Handlebars

{{#d-modal-body title="admin.badges.preview.modal_title" class="badge-query-preview"}}
{{#if errors}}
<p class="error-header">{{i18n "admin.badges.preview.sql_error_header"}}</p>
<pre class="badge-errors">{{errors}}</pre>
{{!--
TODO we want some help pages for this, link to those instead
<p>
{{i18n "admin.badges.preview.error_help"}}
</p>
<ul>
<li><a href="https://meta.discourse.org/t/triggered-custom-badge-queries/19336">https://meta.discourse.org/t/triggered-custom-badge-queries/19336</a></li>
</ul>
--}}
{{else}}
<p class="grant-count">
{{#if count}}
{{html-safe (i18n "admin.badges.preview.grant_count" count=count)}}
{{else}}
{{html-safe (i18n "admin.badges.preview.no_grant_count")}}
{{/if}}
</p>
{{#if countWarning}}
<div class="count-warning">
<p class="heading">
{{d-icon "exclamation-triangle"}}
{{i18n "admin.badges.preview.bad_count_warning.header"}}
</p>
<p class="body">
{{i18n "admin.badges.preview.bad_count_warning.text"}}
</p>
</div>
{{/if}}
{{#if sample}}
<p class="sample">
{{i18n "admin.badges.preview.sample"}}
</p>
<ul>
{{#each processedSample as |html|}}
<li>{{html-safe html}}</li>
{{/each}}
</ul>
{{/if}}
{{#if hasQueryPlan}}
<div class="badge-query-plan">
{{html-safe queryPlanHtml}}
</div>
{{/if}}
{{/if}}
{{/d-modal-body}}