zgdzu
This commit is contained in:
parent
6551cb8c93
commit
20d9319014
2 changed files with 9 additions and 3 deletions
|
@ -9,6 +9,12 @@ from .const import *
|
||||||
|
|
||||||
def send_notification(vid, user, text, db=None):
|
def send_notification(vid, user, text, db=None):
|
||||||
|
|
||||||
|
# for when working outside request context
|
||||||
|
if isinstance(user, int):
|
||||||
|
uid = user
|
||||||
|
else:
|
||||||
|
uid = user.id
|
||||||
|
|
||||||
if not db:
|
if not db:
|
||||||
db = g.db
|
db = g.db
|
||||||
|
|
||||||
|
@ -34,7 +40,7 @@ def send_notification(vid, user, text, db=None):
|
||||||
db.add(new_aux)
|
db.add(new_aux)
|
||||||
|
|
||||||
notif = Notification(comment_id=new_comment.id,
|
notif = Notification(comment_id=new_comment.id,
|
||||||
user_id=user.id)
|
user_id=uid)
|
||||||
db.add(notif)
|
db.add(notif)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -887,7 +887,7 @@ def submit_post(v):
|
||||||
post_url = upload_video(file)
|
post_url = upload_video(file)
|
||||||
new_post.url = post_url
|
new_post.url = post_url
|
||||||
new_post.processing = True
|
new_post.processing = True
|
||||||
gevent.spawn(check_processing_thread, v, new_post, post_url, g.db)
|
gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db)
|
||||||
except UploadException as e:
|
except UploadException as e:
|
||||||
if request.headers.get("Authorization"):
|
if request.headers.get("Authorization"):
|
||||||
return {
|
return {
|
||||||
|
@ -909,7 +909,7 @@ def submit_post(v):
|
||||||
post_url = upload_video(file)
|
post_url = upload_video(file)
|
||||||
new_post.url = post_url
|
new_post.url = post_url
|
||||||
new_post.processing = True
|
new_post.processing = True
|
||||||
gevent.spawn(check_processing_thread, v, new_post, post_url, g.db)
|
gevent.spawn(check_processing_thread, v.id, new_post, post_url, g.db)
|
||||||
except UploadException as e:
|
except UploadException as e:
|
||||||
if request.headers.get("Authorization"):
|
if request.headers.get("Authorization"):
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue