mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 08:33:43 +00:00
playgrounds: Rename name field to playground_name.
The browser seems to autofill the `Name` field of the add-playground form. Most likely this behavior is a result of value of the `name` input field being `name`, causing the browser do to something weird here. This name is now changed to `playground_name`.
This commit is contained in:
committed by
Tim Abbott
parent
b15941610d
commit
72ead6e097
@@ -5,7 +5,7 @@ import type {Page} from "puppeteer";
|
|||||||
import common from "../puppeteer_lib/common";
|
import common from "../puppeteer_lib/common";
|
||||||
|
|
||||||
type Playground = {
|
type Playground = {
|
||||||
name: string;
|
playground_name: string;
|
||||||
pygments_language: string;
|
pygments_language: string;
|
||||||
url_prefix: string;
|
url_prefix: string;
|
||||||
};
|
};
|
||||||
@@ -34,7 +34,7 @@ async function _add_playground_and_return_status(page: Page, payload: Playground
|
|||||||
async function test_successful_playground_creation(page: Page): Promise<void> {
|
async function test_successful_playground_creation(page: Page): Promise<void> {
|
||||||
const payload = {
|
const payload = {
|
||||||
pygments_language: "Python",
|
pygments_language: "Python",
|
||||||
name: "Python3 playground",
|
playground_name: "Python3 playground",
|
||||||
url_prefix: "https://python.example.com",
|
url_prefix: "https://python.example.com",
|
||||||
};
|
};
|
||||||
const status = await _add_playground_and_return_status(page, payload);
|
const status = await _add_playground_and_return_status(page, payload);
|
||||||
@@ -60,7 +60,7 @@ async function test_successful_playground_creation(page: Page): Promise<void> {
|
|||||||
async function test_invalid_playground_parameters(page: Page): Promise<void> {
|
async function test_invalid_playground_parameters(page: Page): Promise<void> {
|
||||||
const payload = {
|
const payload = {
|
||||||
pygments_language: "Python",
|
pygments_language: "Python",
|
||||||
name: "Python3 playground",
|
playground_name: "Python3 playground",
|
||||||
url_prefix: "not_a_url",
|
url_prefix: "not_a_url",
|
||||||
};
|
};
|
||||||
let status = await _add_playground_and_return_status(page, payload);
|
let status = await _add_playground_and_return_status(page, payload);
|
||||||
|
|||||||
@@ -108,17 +108,21 @@ function build_page() {
|
|||||||
|
|
||||||
$(".organization form.admin-playground-form")
|
$(".organization form.admin-playground-form")
|
||||||
.off("submit")
|
.off("submit")
|
||||||
.on("submit", function (e) {
|
.on("submit", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const playground_status = $("#admin-playground-status");
|
const playground_status = $("#admin-playground-status");
|
||||||
const add_playground_button = $(".new-playground-form button");
|
const add_playground_button = $(".new-playground-form button");
|
||||||
add_playground_button.prop("disabled", true);
|
add_playground_button.prop("disabled", true);
|
||||||
playground_status.hide();
|
playground_status.hide();
|
||||||
|
const data = {
|
||||||
|
name: $("#playground_name").val(),
|
||||||
|
pygments_language: $("#playground_pygments_language").val(),
|
||||||
|
url_prefix: $("#playground_url_prefix").val(),
|
||||||
|
};
|
||||||
channel.post({
|
channel.post({
|
||||||
url: "/json/realm/playgrounds",
|
url: "/json/realm/playgrounds",
|
||||||
data: $(this).serialize(),
|
data,
|
||||||
success() {
|
success() {
|
||||||
$("#playground_pygments_language").val("");
|
$("#playground_pygments_language").val("");
|
||||||
$("#playground_name").val("");
|
$("#playground_name").val("");
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="playground_name" class="control-label"> {{t "Name" }}</label>
|
<label for="playground_name" class="control-label"> {{t "Name" }}</label>
|
||||||
<input type="text" id="playground_name" name="name" autocomplete="off" placeholder="Python3 playground" />
|
<input type="text" id="playground_name" name="playground_name" autocomplete="off" placeholder="Python3 playground" />
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="playground_url_prefix" class="control-label"> {{t "URL prefix" }}</label>
|
<label for="playground_url_prefix" class="control-label"> {{t "URL prefix" }}</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user