Check packages for broken links when submitting for approval

Half of #546
This commit is contained in:
rubenwardy
2024-07-04 21:29:56 +01:00
parent a38a650dc1
commit 3f62a41952
7 changed files with 91 additions and 6 deletions

View File

@@ -148,10 +148,20 @@ def post_bot_message(package: Package, title: str, message: str, session=None):
thread.replies.append(reply)
def post_to_approval_thread(package: Package, user: User, message: str, is_status_update=True):
def post_to_approval_thread(package: Package, user: User, message: str, is_status_update=True, create_thread=False):
thread = package.review_thread
if thread is None:
return
if create_thread:
thread = Thread()
thread.author = user
thread.title = "Package approval comments"
thread.private = True
thread.package = package
db.session.add(thread)
db.session.flush()
package.review_thread = thread
else:
return
reply = ThreadReply()
reply.thread = thread