Hide DBL banner if already voted, however homepage always shows regardless

This commit is contained in:
Jeremy Zhang 2018-06-27 23:11:36 +00:00
parent 470607af1a
commit 5cf32ffb0c
2 changed files with 8 additions and 1 deletions

View File

@ -81,4 +81,9 @@ def before_first_request():
@app.context_processor
def context_processor():
return {"devs": get_administrators_list(), "constants": constants, "af_mode_enabled": datetime.datetime.now().date() == datetime.date(datetime.datetime.now().year, 4, 1)}
return {
"devs": get_administrators_list(),
"constants": constants,
"af_mode_enabled": datetime.datetime.now().date() == datetime.date(datetime.datetime.now().year, 4, 1),
"dbl_voted": session.get("unauthenticated", True) == False and bool(redis_store.get("DiscordBotsOrgVoted/" + str(session.get("user_id", -1))))
}

View File

@ -93,11 +93,13 @@
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js" integrity="sha256-uWtSXRErwH9kdJTIr1swfHFJn/d/WQ6s72gELOHXQGM=" crossorigin="anonymous"></script>
{% if not dbl_voted or (dbl_voted and request.path == "/") %}
<script>
$(document).ready(function () {
$('#dblbanner').delay(1000).slideDown("slow");
});
</script>
{% endif %}
{% if af_mode_enabled %}
<script type="text/javascript" src="{{ url_for('static', filename='js/site.af.sausage.js') }}"></script>