fix(panel): the build page trusts the server-side owner tier and drops its mock build seeds

This commit is contained in:
Lemon-miaow committed 2026-09-23 05:11:49 +08:00
1 parent d0b1f9694e
commit 6907961ce0
1 file changed
+6 -14
+6 -14
View File
@@ -61,7 +61,11 @@ export function ImageBuildPage() {
const locale = i18n.language;
const now = Date.now();
const config = useConfig();
const { identity } = useTier();
// The owner tier comes from the server-side /me verdict (TierProvider), never
// from guessing at the address: the old mock-era email heuristic misread the
// real owner ([email protected]) as non-owner while treating any
// "owner@…" address as one.
const { isOwner } = useTier();
// Form & Dialog State
const [dialogOpen, setDialogOpen] = useState(false);
@@ -76,12 +80,6 @@ export function ImageBuildPage() {
const [loadingSubmissions, setLoadingSubmissions] = useState(false);
const [selectedSub, setSelectedSub] = useState<Submission | null>(null);
const isOwner = useMemo(() => {
if (!identity?.email) return false;
const emailLower = identity.email.toLowerCase();
return emailLower === "[email protected]" || emailLower.startsWith("owner@");
}, [identity]);
const visibleSubmissions = useMemo(() => {
if (isOwner) {
return submissions;
@@ -137,12 +135,6 @@ export function ImageBuildPage() {
const stored = localStorage.getItem(LOCAL_STORAGE_KEY);
if (stored) {
setBuildIds(JSON.parse(stored));
} else {
// Seed default IDs so mock builds are loaded on first visit.
// In production, querying these will 404 and safely show the empty state.
const defaultIds = ["bld-1", "bld-2"];
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(defaultIds));
setBuildIds(defaultIds);
}
} catch {
setLoadingBuilds(false);
@@ -598,4 +590,4 @@ export function ImageBuildPage() {
</Card>
</div>
);
}
}