Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(frontend): use case of currentUser.id (#4942)

Liu Ji07e20801e26d
diff --git a/frontend/src/store/modules/activity.ts b/frontend/src/store/modules/activity.ts
index b7d70f87a3..cdf722fa12 100644
--- a/frontend/src/store/modules/activity.ts
+++ b/frontend/src/store/modules/activity.ts
@@ -19,7 +19,7 @@ import {
ActivityFind,
} from "@/types";
import { convertEntityList } from "./utils";
-import { useAuthStore } from "./auth";
+import { useCurrentUser } from "./auth";
import { getPrincipalFromIncludedList } from "./principal";
import { useIssueStore } from "./issue";
@@ -176,10 +176,10 @@ export const useActivityStore = defineStore("activity", {
this.fetchActivityListForIssue(issue);
},
async fetchActivityListForQueryHistory({ limit }: { limit: number }) {
- const { currentUser } = useAuthStore();
+ const currentUser = useCurrentUser();
const activityList = await this.fetchActivityList({
typePrefix: "bb.sql-editor.query",
- user: currentUser.id,
+ user: currentUser.value.id as number,
order: "DESC",
limit,
level: ["INFO", "WARN"],
diff --git a/frontend/src/store/modules/sheet.ts b/frontend/src/store/modules/sheet.ts
index b362e5b82b..ef0e998d03 100644
--- a/frontend/src/store/modules/sheet.ts
+++ b/frontend/src/store/modules/sheet.ts
@@ -19,7 +19,7 @@ import {
SheetPayload,
} from "@/types";
import { getPrincipalFromIncludedList } from "./principal";
-import { useAuthStore } from "./auth";
+import { useCurrentUser } from "./auth";
import { useDatabaseStore } from "./database";
import { useProjectStore } from "./project";
import { useTabStore } from "./tab";
@@ -101,12 +101,12 @@ export const useSheetStore = defineStore("sheet", {
return state.sheetById.get(sheetId) || unknown("SHEET");
},
isCreator() {
- const { currentUser } = useAuthStore();
+ const currentUser = useCurrentUser();
const currentSheet = this.currentSheet as Sheet;
if (!currentSheet) return false;
- return currentUser.id === currentSheet!.creator.id;
+ return currentUser.value.id === currentSheet!.creator.id;
},
/**
* Check the sheet whether is read-only.
@@ -117,7 +117,7 @@ export const useSheetStore = defineStore("sheet", {
* b) If the sheet's visibility is project, will be checked whether the current user is the `OWNER` of the project, only the current user is the `OWNER` of the project, it can be edited.
*/
isReadOnly() {
- const { currentUser } = useAuthStore();
+ const currentUser = useCurrentUser();
const currentSheet = this.currentSheet as Sheet;
// We don't have a selected sheet, we've got nothing to edit.
@@ -135,7 +135,7 @@ export const useSheetStore = defineStore("sheet", {
return true;
}
- return !isSheetWritable(currentSheet, currentUser);
+ return !isSheetWritable(currentSheet, currentUser.value);
},
},