fix(panel): the build page trusts the server-side owner tier and drops its mock build seeds
This commit is contained in:
1 file changed
+6
-14
@@ -61,7 +61,11 @@ export function ImageBuildPage() {
|
|||||||
const locale = i18n.language;
|
const locale = i18n.language;
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const config = useConfig();
|
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
|
// Form & Dialog State
|
||||||
const [dialogOpen, setDialogOpen] = useState(false);
|
const [dialogOpen, setDialogOpen] = useState(false);
|
||||||
@@ -76,12 +80,6 @@ export function ImageBuildPage() {
|
|||||||
const [loadingSubmissions, setLoadingSubmissions] = useState(false);
|
const [loadingSubmissions, setLoadingSubmissions] = useState(false);
|
||||||
const [selectedSub, setSelectedSub] = useState<Submission | null>(null);
|
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(() => {
|
const visibleSubmissions = useMemo(() => {
|
||||||
if (isOwner) {
|
if (isOwner) {
|
||||||
return submissions;
|
return submissions;
|
||||||
@@ -137,12 +135,6 @@ export function ImageBuildPage() {
|
|||||||
const stored = localStorage.getItem(LOCAL_STORAGE_KEY);
|
const stored = localStorage.getItem(LOCAL_STORAGE_KEY);
|
||||||
if (stored) {
|
if (stored) {
|
||||||
setBuildIds(JSON.parse(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 {
|
} catch {
|
||||||
setLoadingBuilds(false);
|
setLoadingBuilds(false);
|
||||||
@@ -598,4 +590,4 @@ export function ImageBuildPage() {
|
|||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user