This commit is contained in:
deflax 2018-04-22 03:33:12 +03:00
parent a8c472dfe8
commit cd8fa2a86c

View file

@ -6,7 +6,7 @@ from . import panel
from .forms import OrderForm, MessageForm from .forms import OrderForm, MessageForm
from .. import db from .. import db
from ..email import send_email from ..email import send_email
from ..models import User, Permission, Recipe, Order, Server, Deployment, Service, Region, Address, Domain, SupportTopic, contact_proxmaster from ..models import User, Permission, Recipe, Order, Server, Deployment, Service, Region, Address, Domain, SupportTopic, SupportLine, contact_proxmaster
import base64 import base64
from datetime import date, time, datetime from datetime import date, time, datetime
@ -124,7 +124,7 @@ def support(topic):
support_topic = EmptySupport() support_topic = EmptySupport()
return render_template('panel/support_item.html', form=form, support=support_topic) return render_template('panel/support_item.html', form=form, support=support_topic)
else: else:
if support_topic.user_id != cuser.user_id: if support_topic.user_id != cuser.pid:
abort(403) #TODO: hidden 403. there is a topic like that but its not yours! abort(403) #TODO: hidden 403. there is a topic like that but its not yours!
else: else:
#topic is yours. show it. #topic is yours. show it.
@ -144,9 +144,9 @@ def support(topic):
flash('ratelimit. try again later') flash('ratelimit. try again later')
return None return None
#create new topic #create new topic
new_topic = SupportTopic(user_id=int(cuser.pid), hashtag=str(topic)) new_topic = SupportTopic(user_id=cuser.pid, hashtag=str(topic))
db.session.add(new_topic) db.session.add(new_topic)
new_line = SupportLine(topic_id=int(new_topic.pid), line=str(form.line.data)) new_line = SupportLine(topic_id=new_topic.pid, line=str(form.line.data))
db.session.add(new_line) db.session.add(new_line)
else: else: