fix(Questions): No more isAnswerId matching for short ids
This commit is contained in:
@@ -4,7 +4,6 @@ const pattern = {
|
||||
emoji: emojiRegex(),
|
||||
email:
|
||||
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
||||
isAnswerId: /^1002\d{13}$/,
|
||||
};
|
||||
|
||||
export default pattern;
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
} from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import Pattern from '@/common/pattern';
|
||||
import { Pagination } from '@/components';
|
||||
import { loggedUserInfoStore, toastStore } from '@/stores';
|
||||
import { scrollToElementTop } from '@/utils';
|
||||
@@ -40,7 +39,7 @@ const Index = () => {
|
||||
* Note: Compatible with Permalink
|
||||
*/
|
||||
let { aid = '' } = useParams();
|
||||
if (!aid && Pattern.isAnswerId.test(slugPermalink)) {
|
||||
if (!aid && slugPermalink) {
|
||||
aid = slugPermalink;
|
||||
}
|
||||
|
||||
@@ -76,9 +75,10 @@ const Index = () => {
|
||||
page: 1,
|
||||
page_size: 999,
|
||||
});
|
||||
|
||||
if (res) {
|
||||
res.list = res.list?.filter((v) => {
|
||||
// delete answers pnly show to author and admin and has searchparams aid
|
||||
// delete answers only show to author and admin and has search params aid
|
||||
if (v.status === 10) {
|
||||
if (
|
||||
(v?.user_info.username === userInfo?.username || isAdmin) &&
|
||||
|
||||
Reference in New Issue
Block a user