1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

Merge pull request #593 from vichan-devel/RealAngeleno-patch-5

Modify email field and selectbox functionality
This commit is contained in:
RealAngeleno 2023-07-10 04:05:45 -07:00 committed by GitHub
commit 485862acaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -80,6 +80,9 @@ class Api {
$toInt = isset(self::$ints[$translated]); $toInt = isset(self::$ints[$translated]);
$val = $object->$local; $val = $object->$local;
if (isset($this->config['hide_email']) && $this->config['hide_email'] && $local === 'email') {
$val = '';
}
if ($val !== null && $val !== '') { if ($val !== null && $val !== '') {
$apiPost[$translated] = $toInt ? (int) $val : $val; $apiPost[$translated] = $toInt ? (int) $val : $val;
} }

View File

@ -21,15 +21,20 @@
</tr>{% endif %} </tr>{% endif %}
{% if not config.field_disable_email or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr> {% if not config.field_disable_email or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr>
<th> <th>
{% if (mod and not post.mod|hasPermission(config.mod.bypass_field_disable, board.uri) and config.field_email_selectbox) or (not mod and config.field_email_selectbox) or (config.hide_email) %}
{% trans %}Options{% endtrans %}
{% else %}
{% trans %}Email{% endtrans %} {% trans %}Email{% endtrans %}
{% endif %}
{{ antibot.html() }} {{ antibot.html() }}
</th> </th>
<td> <td>
{% if config.field_email_selectbox %} {% if (mod and not post.mod|hasPermission(config.mod.bypass_field_disable, board.uri) and config.field_email_selectbox) or (not mod and config.field_email_selectbox) %}
<select name="email" id="email_selectbox" autocomplete="off"> <select name="email" id="email_selectbox" autocomplete="off">
<option value=""></option> <option value=""></option>
<option value="sage">sage</option> <option value="sage">sage</option>
{% if not config.always_noko %}<option value="noko">noko</option>{% endif %} {% if not config.always_noko %}<option value="noko">noko</option>{% endif %}
{% if config.always_noko %}<option value="nonoko">nonoko</option>{% endif %}
</select> </select>
{% else %} {% else %}
<input type="text" name="email" size="25" maxlength="40" autocomplete="off"> <input type="text" name="email" size="25" maxlength="40" autocomplete="off">