Change bot thread title

This commit is contained in:
rubenwardy 2020-12-15 22:51:57 +00:00
parent c5d99e00d8
commit ee9f6454e0
2 changed files with 5 additions and 5 deletions

@ -27,7 +27,7 @@ from kombu import uuid
from app.models import *
from app.tasks import celery, TaskError
from app.utils import randomString, getExtension, post_system_thread
from app.utils import randomString, getExtension, post_bot_message
from .minetestcheck import build_tree, MinetestCheckError, ContentType
@ -329,7 +329,7 @@ def check_update_config(self, package_id):
msg = "Error: {}.\n\nTask ID: {}\n\n[Change update configuration]({})" \
.format(err, self.request.id, package.getUpdateConfigURL())
post_system_thread(package, "Failed to check git repository", msg)
post_bot_message(package, "Failed to check git repository", msg)
db.session.commit()
return
@ -363,7 +363,7 @@ def check_update_config(self, package_id):
msg = "New commit {} was found on the Git repository.{}\n\n[Change update configuration]({})" \
.format(hash[0:5], msg_last, package.getUpdateConfigURL())
post_system_thread(package, "New commit detected, package may be outdated", msg)
post_bot_message(package, "New commit detected, package may be outdated", msg)
config.last_commit = hash
db.session.commit()

@ -255,7 +255,7 @@ def nonEmptyOrNone(str):
return str
def post_system_thread(package: Package, title: str, message: str):
def post_bot_message(package: Package, title: str, message: str):
system_user = User.query.filter_by(username="ContentDB").first()
assert system_user
@ -263,7 +263,7 @@ def post_system_thread(package: Package, title: str, message: str):
if not thread:
thread = Thread()
thread.package = package
thread.title = "System Notifications"
thread.title = "Bot messages for {}".format(package.title)
thread.author = system_user
thread.private = True
thread.watchers.append(package.author)