diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index 476bc2a2..35d0f40f 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -607,7 +607,7 @@ ui: msg: empty: Cannot be empty. login: - page_title: Welcome to Answer + page_title: Welcome to {{site_name}} info_sign: Don't have an account? <1>Sign up info_login: Already have an account? <1>Log in agreements: By registering, you agree to the <1>privacy policy and <3>terms of service. diff --git a/ui/src/components/Comment/index.tsx b/ui/src/components/Comment/index.tsx index 1c3191aa..8bf98aae 100644 --- a/ui/src/components/Comment/index.tsx +++ b/ui/src/components/Comment/index.tsx @@ -27,7 +27,6 @@ import './index.scss'; const Comment = ({ objectId, mode, commentId }) => { const pageUsers = usePageUsers(); const [pageIndex, setPageIndex] = useState(0); - const [comments, setComments] = useState([]); const [visibleComment, setVisibleComment] = useState(false); const pageSize = pageIndex === 0 ? 3 : 15; const { data, mutate } = useQueryComments({ @@ -36,6 +35,7 @@ const Comment = ({ objectId, mode, commentId }) => { page: pageIndex, page_size: pageSize, }); + const [comments, setComments] = useState([]); const reportModal = useReportModal(); @@ -100,6 +100,9 @@ const Comment = ({ objectId, mode, commentId }) => { const users = matchedUsers(item.value); const userNames = unionBy(users.map((user) => user.userName)); const html = marked.parse(parseUserInfo(item.value)); + if (!item.value || !html) { + return; + } const params = { object_id: objectId, original_text: item.value, @@ -164,9 +167,8 @@ const Comment = ({ objectId, mode, commentId }) => { deleteComment(id).then(() => { if (pageIndex === 0) { mutate(); - } else { - setComments(comments.filter((item) => item.comment_id !== id)); } + setComments(comments.filter((item) => item.comment_id !== id)); }); }, }); diff --git a/ui/src/components/Editor/Viewer.tsx b/ui/src/components/Editor/Viewer.tsx index c5bc69f8..fa5cb3ba 100644 --- a/ui/src/components/Editor/Viewer.tsx +++ b/ui/src/components/Editor/Viewer.tsx @@ -14,6 +14,7 @@ import { htmlRender } from './utils'; let scrollTop = 0; marked.setOptions({ breaks: true, + sanitize: true, }); const Index = ({ value }, ref) => { diff --git a/ui/src/components/Footer/index.tsx b/ui/src/components/Footer/index.tsx index eb31feec..578576ce 100644 --- a/ui/src/components/Footer/index.tsx +++ b/ui/src/components/Footer/index.tsx @@ -5,12 +5,10 @@ import { Trans } from 'react-i18next'; import dayjs from 'dayjs'; import { siteInfoStore } from '@/stores'; -import { DEFAULT_SITE_NAME } from '@/common/constants'; const Index = () => { const fullYear = dayjs().format('YYYY'); - const siteName = - siteInfoStore((state) => state.siteInfo.name) || DEFAULT_SITE_NAME; + const siteName = siteInfoStore((state) => state.siteInfo.name); const cc = `${fullYear} ${siteName}`; return (