extend usage of features['NSFW_MARKING']

master
Aevann 2023-02-08 08:22:11 +02:00
parent da7b7ec255
commit 399d32eaf5
3 changed files with 14 additions and 7 deletions

View File

@ -6,7 +6,10 @@ document.getElementById('post-url').value = localStorage.getItem("post-url")
document.getElementById('post-notify').checked = localStorage.getItem("post-notify") == 'true'
document.getElementById('post-new').checked = localStorage.getItem("post-new") == 'true'
document.getElementById('post-nsfw').checked = localStorage.getItem("post-nsfw") == 'true'
const postnsfw = document.getElementById('post-nsfw')
if (postnsfw) {
postnsfw.checked = localStorage.getItem("post-nsfw") == 'true'
}
document.getElementById('post-private').checked = localStorage.getItem("post-private") == 'true'
document.getElementById('post-ghost').checked = localStorage.getItem("post-ghost") == 'true'
@ -120,7 +123,9 @@ function savetext() {
localStorage.setItem("post-notify", document.getElementById('post-notify').checked)
localStorage.setItem("post-new", document.getElementById('post-new').checked)
localStorage.setItem("post-nsfw", document.getElementById('post-nsfw').checked)
if (postnsfw) {
localStorage.setItem("post-nsfw", document.getElementById('post-nsfw').checked)
}
localStorage.setItem("post-private", document.getElementById('post-private').checked)
localStorage.setItem("post-ghost", document.getElementById('post-ghost').checked)
}

View File

@ -674,7 +674,7 @@ def submit_post(v:User, sub=None):
flag_notify = (request.values.get("notify", "on") == "on")
flag_new = request.values.get("new", False, bool) or 'megathread' in title.lower()
flag_over_18 = request.values.get("over_18", False, bool)
flag_over_18 = FEATURES['NSFW_MARKING'] and request.values.get("over_18", False, bool)
flag_private = request.values.get("private", False, bool)
flag_ghost = request.values.get("ghost", False, bool) and v.can_post_in_ghost_threads

View File

@ -41,10 +41,12 @@
<div style="display: inline-block; width: 150px; text-align: center;">Domain:</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam()" class="searchparam mb-1">domain:reddit.com</button>
</div>
<div>
<div style="display: inline-block; width: 150px; text-align: center;">NSFW:</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam()" class="searchparam mb-1">over18:true</button>
</div>
{% if FEATURES['NSFW_MARKING'] %}
<div>
<div style="display: inline-block; width: 150px; text-align: center;">NSFW:</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam()" class="searchparam mb-1">over18:true</button>
</div>
{% endif %}
<div>
<div style="display: inline-block; width: 150px; text-align: center;">{{HOLE_NAME | capitalize }}:</div>
<button type="button" data-nonce="{{g.nonce}}" data-onclick="addParam()" class="searchparam mb-1">{{HOLE_NAME}}:music</button>