mirror of
https://github.com/block/buzz.git
synced 2026-10-29 21:41:33 +00:00
Hide quota-blocked hosted Create and simplify native command checks
Signed-off-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -814,11 +814,10 @@ mod tests {
|
||||
"acknowledgement_version": 1,
|
||||
})
|
||||
);
|
||||
for path in ["/v1/buzz/communities/delete"] {
|
||||
let url = api_url(path).expect("deletion URL");
|
||||
assert_eq!(url.origin().ascii_serialization(), BUILDERLAB_ORIGIN);
|
||||
assert_eq!(url.path(), format!("/api/goose{path}"));
|
||||
}
|
||||
let path = "/v1/buzz/communities/delete";
|
||||
let url = api_url(path).expect("deletion URL");
|
||||
assert_eq!(url.origin().ascii_serialization(), BUILDERLAB_ORIGIN);
|
||||
assert_eq!(url.path(), format!("/api/goose{path}"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -836,13 +835,12 @@ mod tests {
|
||||
#[test]
|
||||
fn community_deletion_commands_are_registered_on_the_native_boundary() {
|
||||
let lib = include_str!("lib.rs");
|
||||
for command in ["delete_builderlab_community,"] {
|
||||
assert_eq!(
|
||||
lib.matches(command).count(),
|
||||
1,
|
||||
"{command} must be registered exactly once"
|
||||
);
|
||||
}
|
||||
let command = "delete_builderlab_community,";
|
||||
assert_eq!(
|
||||
lib.matches(command).count(),
|
||||
1,
|
||||
"{command} must be registered exactly once"
|
||||
);
|
||||
assert!(!lib.contains("get_builderlab_community_deletion_receipt"));
|
||||
let source = include_str!("builderlab.rs");
|
||||
assert!(source.contains(".header(reqwest::header::ORIGIN, BUILDERLAB_ORIGIN)"));
|
||||
|
||||
@@ -1106,23 +1106,24 @@ export function HostedCommunitiesSettingsCard() {
|
||||
That address is available.
|
||||
</p>
|
||||
) : null}
|
||||
<Button
|
||||
disabled={
|
||||
!usableBoundIdentity ||
|
||||
identityMismatch ||
|
||||
!validName ||
|
||||
availability === false ||
|
||||
checkingName ||
|
||||
busy ||
|
||||
atCommunityLimit
|
||||
}
|
||||
type="submit"
|
||||
>
|
||||
{action ? (
|
||||
<LoaderCircle className="h-4 w-4 animate-spin" />
|
||||
) : null}
|
||||
{action ?? "Create and connect"}
|
||||
</Button>
|
||||
{!atCommunityLimit ? (
|
||||
<Button
|
||||
disabled={
|
||||
!usableBoundIdentity ||
|
||||
identityMismatch ||
|
||||
!validName ||
|
||||
availability === false ||
|
||||
checkingName ||
|
||||
busy
|
||||
}
|
||||
type="submit"
|
||||
>
|
||||
{action ? (
|
||||
<LoaderCircle className="h-4 w-4 animate-spin" />
|
||||
) : null}
|
||||
{action ?? "Create and connect"}
|
||||
</Button>
|
||||
) : null}
|
||||
</form>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -193,6 +193,27 @@ test("deletion is default-off and identity mismatch preserves the gate", async (
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("explicit quota false hides Create and shows the limit copy", async ({
|
||||
page,
|
||||
}) => {
|
||||
await openDeletionFixture(page);
|
||||
await page.evaluate(() => {
|
||||
if (window.__BUZZ_E2E__?.mock)
|
||||
window.__BUZZ_E2E__.mock.builderlabQuota = {
|
||||
used: 5,
|
||||
limit: 5,
|
||||
canCreate: false,
|
||||
};
|
||||
});
|
||||
await page.getByRole("button", { name: "Refresh" }).click();
|
||||
await expect(
|
||||
page.getByText(/reached the limit of 5 hosted communities/),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Create and connect" }),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("archived deletion requires exact host and two confirmations, then removes the row", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
Reference in New Issue
Block a user