审计日志并入系统管理、规范项目成员获取逻辑
This commit is contained in:
@@ -117,7 +117,7 @@ import {
|
||||
setFaqStatus,
|
||||
} from "../api/faqs";
|
||||
import { listMembers } from "../api/members";
|
||||
import { displayDateTime, displayUser } from "../utils/display";
|
||||
import { displayDateTime, displayUser, getMemberDisplayName, getUserDisplayName } from "../utils/display";
|
||||
import { useAuthStore } from "../store/auth";
|
||||
import { usePermission } from "../utils/permission";
|
||||
import FaqItemForm from "../components/FaqItemForm.vue";
|
||||
@@ -185,16 +185,28 @@ const bestReply = computed(() => {
|
||||
|
||||
const memberMap = computed(() =>
|
||||
members.value.reduce<Record<string, string>>((acc, cur) => {
|
||||
const username = cur?.user?.display_name || cur?.user?.username || cur?.username;
|
||||
if (cur?.user_id) acc[cur.user_id] = username || cur.user_id;
|
||||
const username = getMemberDisplayName(cur);
|
||||
if (cur?.user_id && username) acc[cur.user_id] = username;
|
||||
return acc;
|
||||
}, {})
|
||||
);
|
||||
|
||||
const userMap = computed(() => {
|
||||
if (!auth.user?.id) return {};
|
||||
const name = auth.user.display_name || auth.user.username || auth.user.id;
|
||||
return { [auth.user.id]: name };
|
||||
const map: Record<string, string> = {};
|
||||
if (auth.user?.id) {
|
||||
const name = getUserDisplayName(auth.user) || auth.user.id;
|
||||
map[auth.user.id] = name;
|
||||
}
|
||||
const push = (id?: string | null, name?: string | null) => {
|
||||
if (!id || !name) return;
|
||||
map[id] = name;
|
||||
};
|
||||
push(item.value?.created_by, item.value?.created_by_name || item.value?.created_by_display_name || item.value?.created_by_email);
|
||||
replies.value.forEach((r) => {
|
||||
push(r?.created_by, r?.created_by_name || r?.created_by_display_name || r?.created_by_email);
|
||||
push(r?.quote?.created_by, r?.quote?.created_by_name || r?.quote?.created_by_display_name || r?.quote?.created_by_email);
|
||||
});
|
||||
return map;
|
||||
});
|
||||
|
||||
const categoryName = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user