From b4c5cd81ea43abf42e69f1b7b40ccf051ff9e622 Mon Sep 17 00:00:00 2001 From: lian Date: Sat, 11 Oct 2025 15:34:53 +0800 Subject: [PATCH] show empty tip when no terms (#8294) * show empty tip when no terms * update --- .../sys-admin/terms-and-conditions/content.js | 2 +- frontend/src/tc-view.js | 26 ++++++++++++++----- thirdpart/termsandconditions/models.py | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/sys-admin/terms-and-conditions/content.js b/frontend/src/pages/sys-admin/terms-and-conditions/content.js index 366b885e5b..6a98701faa 100644 --- a/frontend/src/pages/sys-admin/terms-and-conditions/content.js +++ b/frontend/src/pages/sys-admin/terms-and-conditions/content.js @@ -38,7 +38,7 @@ class Content extends Component { return

{errorMsg}

; } else { const emptyTip = ( - + ); const table = ( diff --git a/frontend/src/tc-view.js b/frontend/src/tc-view.js index 4ecc287629..3d0bbd429b 100644 --- a/frontend/src/tc-view.js +++ b/frontend/src/tc-view.js @@ -1,9 +1,11 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; import Logo from './components/logo'; +import EmptyTip from './components/empty-tip'; import Account from './components/common/account'; import TermsPreviewWidget from './components/terms-preview-widget'; import { Utils } from './utils/utils'; +import { gettext } from './utils/constants'; import './css/tc-accept.css'; @@ -21,14 +23,26 @@ class TCView extends React.Component { -
-
-

-
- + { termsText ? +
+
+

+
+ +
-
+ : +
+ +

{gettext('There is no teams and conditions yet.')}

+ + } + /> +
+ }
); } diff --git a/thirdpart/termsandconditions/models.py b/thirdpart/termsandconditions/models.py index e24f722fb9..83f455b12a 100644 --- a/thirdpart/termsandconditions/models.py +++ b/thirdpart/termsandconditions/models.py @@ -74,7 +74,7 @@ class TermsAndConditions(models.Model): date_active__lte=timezone.now(), slug=slug).latest('date_active') except TermsAndConditions.DoesNotExist: - raise Http404 + active_terms = None return active_terms