Project settings no longer print the creator's raw id
1 file+6−30/1 viewed
| 27 | 27 | // Whether Deployments are on: needs Admin, so unknown (null) below it. | |
| 28 | 28 | deployments.settings({ workspace: params.owner, slug: params.repo }, viewer).catch(() => null), | |
| 29 | 29 | ]); | |
| 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 }; | |
| 31 | 33 | } | |
| 32 | 34 | ||
| 33 | 35 | export async function action({ request, params, context }: Route.ActionArgs) { | |
| 46 | 48 | } | |
| 47 | 49 | ||
| 48 | 50 | export default function ProjectSettings({ loaderData, actionData, params }: Route.ComponentProps) { | |
| 49 | − | const { project, deploymentsOn } = loaderData; | |
| 51 | + | const { project, deploymentsOn, mine } = loaderData; | |
| 50 | 52 | const [deploys, setDeploys] = useState<DeploysSetting>(project.deploys); | |
| 51 | 53 | // Not deploying while Deployments are on is refused: they are turned off first. | |
| 52 | 54 | const blocked = deploys === "no" && project.deploys !== "no" && deploymentsOn === true; | |
| 182 | 184 | </Button> | |
| 183 | 185 | {actionData && "saved" in actionData && <span className="text-sm text-accent">Saved.</span>} | |
| 184 | 186 | <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} /> | |
| 186 | 189 | </span> | |
| 187 | 190 | </div> | |
| 188 | 191 | <ErrorText>{actionData && "error" in actionData ? actionData.error : null}</ErrorText> |