Simple bugfix merges (#1531)

* Closes #1530 
* Clean up some wording and comments
* Pin isort version to fix flake8 issue (https://github.com/gforcada/flake8-isort/issues/88)
This commit is contained in:
Kevin Chung
2020-07-06 15:34:55 -04:00
committed by GitHub
parent adc70fb320
commit 7dcfba40b3
10 changed files with 32 additions and 6 deletions

View File

@@ -374,6 +374,7 @@ class Challenge(Resource):
response["solves"] = solves
else:
response["solves"] = None
solves = None
if authed():
# Get current attempts for the user

View File

@@ -399,7 +399,7 @@ $(() => {
ezQuery({
title: "Missing Flags",
body:
"This challenge does not have any flags meaning it is unsolveable. Are you sure you'd like to update this challenge?",
"This challenge does not have any flags meaning it may be unsolveable. Are you sure you'd like to update this challenge?",
success: update_challenge
});
} else {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -52,6 +52,13 @@ const displayChal = chal => {
$("#challenge-window").empty();
// Inject challenge data into the plugin
challenge.data = responses[0].data;
// Call preRender function in plugin
challenge.preRender();
// Build HTML from the Jinja response in API
$("#challenge-window").append(responses[0].data.view);
$("#challenge-window #challenge-input").addClass("form-control");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -12,7 +12,9 @@ format:
prettier --write '**/*.md'
test:
pytest -rf --cov=CTFd --cov-context=test --ignore=node_modules/ \
pytest -rf --cov=CTFd --cov-context=test \
--ignore-glob="**/node_modules/" \
--ignore=node_modules/ \
-W ignore::sqlalchemy.exc.SADeprecationWarning \
-W ignore::sqlalchemy.exc.SAWarning \
-n auto

View File

@@ -14,6 +14,7 @@ pytest-xdist==1.32.0
pytest-cov==2.9.0
sphinx_rtd_theme==0.4.3
flask-debugtoolbar==0.11.0
isort==4.3.21
flake8-isort==3.0.0
Faker==4.1.0
pipdeptree==0.13.2

View File

@@ -244,6 +244,21 @@ def test_api_challenge_get_visibility_private():
destroy_ctfd(app)
def test_api_challenge_get_with_admin_only_account_visibility():
"""Can a private user get /api/v1/challenges/<challenge_id> if account_visibility is admins_only"""
app = create_ctfd()
with app.app_context():
gen_challenge(app.db)
register_user(app)
client = login_as_user(app)
r = client.get("/api/v1/challenges/1")
assert r.status_code == 200
set_config("account_visibility", "admins")
r = client.get("/api/v1/challenges/1")
assert r.status_code == 200
destroy_ctfd(app)
def test_api_challenge_get_ctftime_private():
"""Can a private user get /api/v1/challenges/<challenge_id> if ctftime is over"""
app = create_ctfd()