fds
This commit is contained in:
parent
3f9076342f
commit
7c23eea71c
6 changed files with 31 additions and 12 deletions
|
@ -516,7 +516,6 @@ class User(Base):
|
|||
if days > 0:
|
||||
ban_time = int(time.time()) + (days * 86400)
|
||||
self.unban_utc = ban_time
|
||||
|
||||
else:
|
||||
self.bannerurl = None
|
||||
self.profileurl = None
|
||||
|
|
|
@ -861,17 +861,15 @@ def ban_user(user_id, v):
|
|||
|
||||
# check for number of days for suspension
|
||||
if 'form' in request.values:
|
||||
days = int(request.values.get("days")) if request.values.get('days') else 0
|
||||
days = request.values.get("days", 0)
|
||||
reason = sanitize(request.values.get("reason", ""))
|
||||
message = request.values.get("reason", "")
|
||||
else:
|
||||
days = int(request.values.get("days")) if request.values.get('days') else 0
|
||||
days = request.values.get("days", 0)
|
||||
reason = sanitize(request.values.get("reason", ""))
|
||||
message = request.values.get("reason", "")
|
||||
|
||||
if not user: abort(400)
|
||||
|
||||
#if user.admin_level > 0: abort(403)
|
||||
|
||||
if days > 0:
|
||||
if message:
|
||||
|
|
|
@ -114,8 +114,10 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
|||
|
||||
posts = g.db.query(Submission).options(lazyload('*'))
|
||||
|
||||
if t != 'all':
|
||||
cutoff = 0
|
||||
if t != 'day' and sort in ["hot","controversial"]:
|
||||
cutoff = int(time.time()) - 86400
|
||||
posts = posts.filter(Submission.created_utc >= cutoff)
|
||||
elif t != 'all':
|
||||
now = int(time.time())
|
||||
if t == 'hour':
|
||||
cutoff = now - 3600
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<textarea name="reason" form="banModalForm" class="form-control" id="ban-modal-link" aria-label="With textarea" placeholder="Enter reason"></textarea>
|
||||
|
||||
<label for="days" class="mt-3">Duration days</label>
|
||||
<input type="number" name="days" id="days" class="form-control" placeholder="leave blank for permanent" />
|
||||
<input type="number" step="any" name="days" id="days" class="form-control" placeholder="leave blank for permanent" />
|
||||
|
||||
<div class="custom-control custom-switch mt-3">
|
||||
<input type="checkbox" class="custom-control-input" id="alts" name="alts">
|
||||
|
|
|
@ -14,6 +14,26 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
|
||||
|
||||
<script>
|
||||
var clipboard = new ClipboardJS('.copy-link');
|
||||
clipboard.on('success', function(e) {
|
||||
|
||||
jQuery(function($) {
|
||||
$('#toast-success').toast('show');
|
||||
})
|
||||
console.log(e);
|
||||
});
|
||||
clipboard.on('error', function(e) {
|
||||
|
||||
jQuery(function($) {
|
||||
$('#toast-error').toast('show');
|
||||
})
|
||||
console.log(e);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="row justify-content-around">
|
||||
|
||||
<div class="col h-100">
|
||||
|
|
|
@ -299,7 +299,7 @@
|
|||
<form action="/ban_user/{{u.id}}" method="post" action="">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<input style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit').disabled=false">
|
||||
<input style="font-size:11px;" type="number" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
||||
<input style="font-size:11px;" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="alts-2-desktop" class="custom-control-input" name="alts" value="1">
|
||||
<label class="custom-control-label" for="alts-2-desktop">Include alts</label>
|
||||
|
@ -312,7 +312,7 @@
|
|||
|
||||
<form id="agendaposter" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
||||
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
||||
<input type="number" name="days" class="form-control" placeholder="Days (0 or blank = permanent)" />
|
||||
<input type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)" />
|
||||
<input type="submit" class="btn btn-danger" value="Lock Agendaposter Theme" />
|
||||
</form>
|
||||
|
||||
|
@ -574,7 +574,7 @@
|
|||
<form action="/ban_user/{{u.id}}/" method="post">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<input style="font-size:11px;" type="text" class="form-control" name="reason" placeholder="Ban Reason" onchange="document.getElementById('user-ban-submit2').disabled=false">
|
||||
<input style="font-size:11px;" type="number" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
||||
<input style="font-size:11px;" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
|
||||
<br />
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" id="alts-2-mobile" class="custom-control-input" name="alts" value="1">
|
||||
|
@ -589,7 +589,7 @@
|
|||
|
||||
<form id="agendaposter2" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
||||
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
||||
<input type="number" name="days" class="form-control" placeholder="Days (0 or blank = permanent)" />
|
||||
<input type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)" />
|
||||
<input type="submit" class="btn btn-danger" value="Lock Agendaposter Theme" />
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue