more bugfix

This commit is contained in:
deflax 2018-04-22 03:50:31 +03:00
parent cd8fa2a86c
commit 75dacd8c8a
2 changed files with 7 additions and 6 deletions

View file

@ -100,7 +100,7 @@ def dashboard(user_pid):
return render_template('panel/dashboard.html', sys_regions=sys_regions, inv_deployments=inv_deployments, inv_services=inv_services, inv_domains=inv_domains, inv_addresses=inv_addresses, rrd=rrd, status=statuses, warnflag=warnflag, regions=regions)
#SUPPORT
@panel.route("/support", methods=['GET', 'POST'])
@panel.route("/support", methods=['GET'])
@login_required
def list_support():
""" general enquiry and list all open support tasks """
@ -142,7 +142,7 @@ def support(topic):
expiry = time_last_topic + relativedelta(time_last_topic, minutes=+5)
if now < expiry:
flash('ratelimit. try again later')
return None
return redirect(url_for('panel.dashboard'))
#create new topic
new_topic = SupportTopic(user_id=cuser.pid, hashtag=str(topic))
db.session.add(new_topic)
@ -150,11 +150,12 @@ def support(topic):
db.session.add(new_line)
else:
if support_topic.user_id == cuser.user_id:
new_line = SupportLine(topic_id=int(support_topic.pid), line=str(form.line.data))
if support_topic.user_id == cuser.pid:
new_line = SupportLine(topic_id=support_topic.pid, line=form.line.data)
db.session.add(new_line)
else:
abort(403) #TODO: hidden 404
db.session.commit()
return None
return redirect(url_for('panel.dashboard'))

View file

@ -24,7 +24,7 @@ $('a[data-toggle="tooltip"]').tooltip({
<div class="panel-heading">Support</div>
<div class="panel-body"><p>
<div class="panel-group" id="<s" role="tablist" aria-multiselectable="true">
{% for topic in inv_topics %}
{% for support in inv_topics %}
{% include "panel/support_item.html" %}
{% endfor %}
</div>