Make call to controller and not stale object

This commit is contained in:
amcmanu3 2022-06-11 17:34:31 -04:00
parent 0ed4347254
commit e99cacfc53
2 changed files with 9 additions and 4 deletions

View File

@ -273,7 +273,9 @@ class ServersController(metaclass=Singleton):
latest = srv.stats_helper.get_latest_server_stats()
server_data.append(
{
"server_data": server["server_data_obj"],
"server_data": ServersController.get_server_data_by_id(
server.get("server_id")
),
"stats": latest,
"user_command_permission": True,
}
@ -328,7 +330,9 @@ class ServersController(metaclass=Singleton):
user_command_permission = False
server_data.append(
{
"server_data": DatabaseShortcuts.get_data_obj(server.server_object),
"server_data": ServersController.get_server_data_by_id(
server.server_id
),
"stats": latest,
"user_command_permission": user_command_permission,
}

View File

@ -7,6 +7,7 @@ import json
import logging
import threading
import bleach
from app.classes.controllers.servers_controller import ServersController
import libgravatar
import requests
import tornado.web
@ -258,7 +259,7 @@ class PanelHandler(BaseHandler):
for server in defined_servers[:]:
if str(server.server_id) == str(server_id):
page_servers.append(
DatabaseShortcuts.get_data_obj(server.server_object)
ServersController.get_server_data_by_id(server.server_id)
)
user_order.remove(server_id)
defined_servers.remove(server)
@ -267,7 +268,7 @@ class PanelHandler(BaseHandler):
server_ids.append(str(server.server_id))
if server not in page_servers:
page_servers.append(
DatabaseShortcuts.get_data_obj(server.server_object)
ServersController.get_server_data_by_id(server.server_id)
)
for server_id in user_order[:]: