From 694351baa83279a7a62958251d9ae1767bdc2ed3 Mon Sep 17 00:00:00 2001 From: RealAngeleno Date: Mon, 10 Jul 2023 03:39:34 -0700 Subject: [PATCH 1/2] fix email logic and add nonoko setting to selectbox Changes it so that if the user is mod and they can bypass fields, "email" will show up just fine. If not, "email" will become an options field, like on 4chan. The options field will show up for anybody if hide_email is set to true. Nonoko will be in the selectbox if always_noko is set to true. --- templates/post_form.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/post_form.html b/templates/post_form.html index e6d77314..0febce44 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -21,15 +21,20 @@ {% endif %} {% if not config.field_disable_email or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %} + {% 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 %} + {% endif %} {{ antibot.html() }} - {% 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) %} {% else %} From f48872d5a4601668270c80dab2dcdce30827c14c Mon Sep 17 00:00:00 2001 From: RealAngeleno Date: Mon, 10 Jul 2023 04:02:51 -0700 Subject: [PATCH 2/2] prohibit emails from showing up in api if hide_email is true --- inc/api.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inc/api.php b/inc/api.php index 3a5c8da3..0dd479ac 100644 --- a/inc/api.php +++ b/inc/api.php @@ -80,6 +80,9 @@ class Api { $toInt = isset(self::$ints[$translated]); $val = $object->$local; + if (isset($this->config['hide_email']) && $this->config['hide_email'] && $local === 'email') { + $val = ''; + } if ($val !== null && $val !== '') { $apiPost[$translated] = $toInt ? (int) $val : $val; }