fix: harden v2 custom widgets and Workshop (#6480)
This commit is contained in:
1 parent
e8a2c87c2d
commit
557ebe0a2f
138 files changed
+5151
-1976
No files matched your search
@@ -4,6 +4,7 @@ import Link from "@docusaurus/Link";
|
||||
import { useLocation } from "@docusaurus/router";
|
||||
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
||||
import Layout from "@theme/Layout";
|
||||
|
||||
import {
|
||||
IconArrowBigDown,
|
||||
IconArrowBigUp,
|
||||
@@ -335,7 +336,7 @@ const MarketplaceDetail = ({ workshopUrl }: { workshopUrl: string }) => {
|
||||
if (!submission) return;
|
||||
try {
|
||||
const updated = await backend.toggleOutdated(submission.id, !submission.outdated);
|
||||
setSubmission({ ...submission, outdated: updated.outdated });
|
||||
setSubmission(updated);
|
||||
setError(null);
|
||||
toast.success(updated.outdated ? "Submission marked as outdated" : "Submission marked as current");
|
||||
} catch (caught) {
|
||||
@@ -453,7 +454,7 @@ const MarketplaceDetail = ({ workshopUrl }: { workshopUrl: string }) => {
|
||||
setReportOpen(false);
|
||||
setReportExplanation("");
|
||||
setError(null);
|
||||
toast.success("Report submitted", { description: "A Workshop administrator can now review it." });
|
||||
toast.success("Report submitted", { description: "A Workshop moderator can now review it." });
|
||||
} catch (caught) {
|
||||
setReportError(errorMessage(caught, "Failed to submit report"));
|
||||
} finally {
|
||||
@@ -863,7 +864,7 @@ const MarketplaceDetail = ({ workshopUrl }: { workshopUrl: string }) => {
|
||||
<DialogHeader>
|
||||
<DialogTitle>Report submission</DialogTitle>
|
||||
<DialogDescription>
|
||||
Only Workshop administrators can review report details and reporter identities.
|
||||
Only Workshop moderators can review report details and reporter identities.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
{reportError && (
|
||||
|
||||
@@ -52,7 +52,7 @@ export function WorkshopAdmin({ workshopUrl }: { workshopUrl?: string }) {
|
||||
setSubmissions(nextSubmissions);
|
||||
setError("");
|
||||
} catch (cause) {
|
||||
setError(cause instanceof Error ? cause.message : "Unable to load Workshop administration");
|
||||
setError(cause instanceof Error ? cause.message : "Unable to load Workshop moderation");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ export function WorkshopAdmin({ workshopUrl }: { workshopUrl?: string }) {
|
||||
<IconShield size={18} />
|
||||
<span className="text-sm font-medium">Restricted area</span>
|
||||
</div>
|
||||
<h1 className="text-3xl font-semibold tracking-tight">Workshop administration</h1>
|
||||
<h1 className="text-3xl font-semibold tracking-tight">Workshop moderation</h1>
|
||||
<p className="mt-2 max-w-2xl text-sm text-muted-foreground">
|
||||
Review reports and remove unsafe or outdated submissions. PocketBase rules enforce every action.
|
||||
</p>
|
||||
@@ -145,14 +145,14 @@ export function WorkshopAdmin({ workshopUrl }: { workshopUrl?: string }) {
|
||||
{user && !user.isAdmin && (
|
||||
<Alert variant="destructive" className="mb-5">
|
||||
<IconShield />
|
||||
<AlertTitle>Administrator access required</AlertTitle>
|
||||
<AlertTitle>Workshop moderator access required</AlertTitle>
|
||||
<AlertDescription>This GitHub account cannot access Workshop moderation.</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
{error && (
|
||||
<Alert variant="destructive" className="mb-5">
|
||||
<IconFlag />
|
||||
<AlertTitle>Workshop administration failed</AlertTitle>
|
||||
<AlertTitle>Workshop moderation failed</AlertTitle>
|
||||
<AlertDescription>{error}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user