Skip to content

Commit

Permalink
Misc bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dssecret committed Nov 12, 2023
1 parent 5654f37 commit 12d821b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion controllers/api/bot/faction.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def faction_setter(guild_id: int, *args, **kwargs):
return make_exception_response("4020", key)

try:
Faction.select().get_by_id(faction_tid)
Faction.select().where(Faction.tid == faction_tid).get()
except DoesNotExist:
return make_exception_response("1102", key)

Expand Down
12 changes: 7 additions & 5 deletions controllers/api/bot/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
def jsonified_verify_config(guild: Server):
return jsonify(
{
"enabled": guild.config.get("verify"),
"enabled": guild.verify_enabled,
"verify_template": guild.verify_template,
"verified_roles": guild.verified_roles,
"faction_verify": guild.faction_verify,
Expand Down Expand Up @@ -76,9 +76,11 @@ def guild_verification(*args, **kwargs):
if kwargs["user"].tid not in guild.admins:
return make_exception_response("4020", key)

# TODO: Replace below error messages

if request.method == "POST":
if guild.config.get("verify") in (None, 0):
guild.config["verify"] = 1
if not guild.verify_enabled:
guild.verify_enabled = True
guild.save()
else:
return make_exception_response(
Expand All @@ -90,8 +92,8 @@ def guild_verification(*args, **kwargs):
},
)
elif request.method == "DELETE":
if guild.config.get("verify") in (None, 1):
guild.config["verify"] = 0
if guild.config.verify_enabled:
guild.verify_enabled = False
guild.save()
else:
return make_exception_response(
Expand Down
2 changes: 0 additions & 2 deletions controllers/authroutes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from tornium_celery.tasks.misc import send_dm
from tornium_celery.tasks.user import update_user
from tornium_commons import Config, rds
from tornium_commons.db_connection import requires_db_connection
from tornium_commons.errors import MissingKeyError, NetworkingError, TornError
from tornium_commons.models import User
from tornium_commons.skyutils import SKYNET_INFO
Expand All @@ -50,7 +49,6 @@
config = Config.from_json()


@requires_db_connection
@mod.route("/login", methods=["GET", "POST"])
def login(*args, **kwargs):
if request.method == "GET":
Expand Down
4 changes: 2 additions & 2 deletions controllers/bot/oc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@


@fresh_login_required
def oc_dashboard(guildid):
def oc_dashboard(guild_id):
return render_template(
"bot/oc.html",
guildid=guildid,
guildid=guild_id,
)
2 changes: 0 additions & 2 deletions controllers/faction/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@

from flask import render_template
from flask_login import current_user, login_required
from tornium_commons import requires_db_connection
from tornium_commons.models import Faction, User

from controllers.faction.decorators import fac_required


@requires_db_connection
@login_required
@fac_required
def members(*args, **kwargs):
Expand Down

0 comments on commit 12d821b

Please sign in to comment.