Revert "perf: remove ticket model" (#13145)

This reverts commit 94567b86f0.
pull/13088/head^2
feng626 2024-04-28 18:26:49 +08:00 committed by GitHub
parent 94567b86f0
commit fbc4cb9046
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 3 additions and 19 deletions

View File

@ -68,7 +68,7 @@ class ActionAclSerializer(serializers.Serializer):
field_action = self.fields.get("action")
if not field_action:
return
if not (settings.XPACK_LICENSE_IS_VALID and settings.TICKETS_ENABLED):
if not settings.XPACK_LICENSE_IS_VALID:
field_action._choices.pop(ActionChoices.review, None)
for choice in self.Meta.action_choices_exclude:
field_action._choices.pop(choice, None)

View File

@ -1,6 +1,5 @@
# coding:utf-8
#
from django.conf import settings
from django.urls import path
from rest_framework.routers import DefaultRouter
@ -32,13 +31,7 @@ urlpatterns = [
path('mfa/send-code/', api.MFASendCodeApi.as_view(), name='mfa-send-code'),
path('password/reset-code/', api.UserResetPasswordSendCodeApi.as_view(), name='reset-password-code'),
path('password/verify/', api.UserPasswordVerifyApi.as_view(), name='user-password-verify'),
]
ticket_urlpatterns = [
path('login-confirm-ticket/status/', api.TicketStatusApi.as_view(), name='login-confirm-ticket-status'),
]
if settings.TICKETS_ENABLED:
urlpatterns.extend(ticket_urlpatterns)
urlpatterns += router.urls + passkey_urlpatterns

View File

@ -135,9 +135,8 @@ AUTH_EXPIRED_SECONDS = 60 * 10
CHANGE_AUTH_PLAN_SECURE_MODE_ENABLED = CONFIG.CHANGE_AUTH_PLAN_SECURE_MODE_ENABLED
DATETIME_DISPLAY_FORMAT = '%Y-%m-%d %H:%M:%S'
# TICKETS_ENABLED always disabled
TICKETS_ENABLED = False
TICKETS_ENABLED = CONFIG.TICKETS_ENABLED
REFERER_CHECK_ENABLED = CONFIG.REFERER_CHECK_ENABLED
CONNECTION_TOKEN_ENABLED = CONFIG.CONNECTION_TOKEN_ENABLED

View File

@ -108,7 +108,7 @@ class ChatAISettingSerializer(serializers.Serializer):
class TicketSettingSerializer(serializers.Serializer):
PREFIX_TITLE = _('Ticket')
# TICKETS_ENABLED = serializers.BooleanField(required=False, default=True, label=_("Ticket"))
TICKETS_ENABLED = serializers.BooleanField(required=False, default=True, label=_("Ticket"))
TICKET_AUTHORIZE_DEFAULT_TIME = serializers.IntegerField(
min_value=1, max_value=999999, required=False,
label=_("Default period")

View File

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
#
from django.conf import settings
from django.urls import path
from rest_framework_bulk.routes import BulkRouter
@ -25,6 +24,3 @@ urlpatterns = [
path('super-tickets/<uuid:pk>/status/', api.SuperTicketStatusAPI.as_view(), name='super-ticket-status'),
]
urlpatterns += router.urls
if not settings.TICKETS_ENABLED:
urlpatterns = []

View File

@ -1,7 +1,6 @@
# coding:utf-8
#
from django.conf import settings
from django.urls import path
from .. import views
@ -11,6 +10,3 @@ app_name = 'tickets'
urlpatterns = [
path('direct-approve/<str:token>/', views.TicketDirectApproveView.as_view(), name='direct-approve'),
]
if not settings.TICKETS_ENABLED:
urlpatterns = []