Commit

Project settings no longer print the creator's raw id

syntaqxcommitted Parent1465e06Browse files
1 file+6−30/1 viewed
+6−3
2727 // Whether Deployments are on: needs Admin, so unknown (null) below it.
2828 deployments.settings({ workspace: params.owner, slug: params.repo }, viewer).catch(() => null),
2929 ]);
30− return { project: unwrap(project), deploymentsOn: deploys?.ok ? deploys.value.enabled : null };
30+ const found = unwrap(project);
31+ // Who made it is kept as an id; name it only when it was the viewer.
32+ return { project: found, deploymentsOn: deploys?.ok ? deploys.value.enabled : null, mine: viewer?.id === found.createdBy };
3133 }
3234
3335 export async function action({ request, params, context }: Route.ActionArgs) {
4648 }
4749
4850 export default function ProjectSettings({ loaderData, actionData, params }: Route.ComponentProps) {
49− const { project, deploymentsOn } = loaderData;
51+ const { project, deploymentsOn, mine } = loaderData;
5052 const [deploys, setDeploys] = useState<DeploysSetting>(project.deploys);
5153 // Not deploying while Deployments are on is refused: they are turned off first.
5254 const blocked = deploys === "no" && project.deploys !== "no" && deploymentsOn === true;
182184 </Button>
183185 {actionData && "saved" in actionData && <span className="text-sm text-accent">Saved.</span>}
184186 <span className="ml-auto text-xs text-faint">
185− Created by {project.createdBy} <TimeAgo at={project.createdAt} />
187+ Created {mine && "by you "}
188+ <TimeAgo at={project.createdAt} />
186189 </span>
187190 </div>
188191 <ErrorText>{actionData && "error" in actionData ? actionData.error : null}</ErrorText>