forked from retoor/devplacepy
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32314fc6d6 |
File diff suppressed because one or more lines are too long
@@ -7,12 +7,12 @@ from devplacepy.cli._shared import _audit_cli
|
|||||||
def _remove_zip_artifacts(job):
|
def _remove_zip_artifacts(job):
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from devplacepy.services.jobs.zip_service import STAGING_DIR
|
from devplacepy.config import ZIP_STAGING_DIR
|
||||||
|
|
||||||
local_path = (job.get("result") or {}).get("local_path")
|
local_path = (job.get("result") or {}).get("local_path")
|
||||||
if local_path:
|
if local_path:
|
||||||
Path(local_path).unlink(missing_ok=True)
|
Path(local_path).unlink(missing_ok=True)
|
||||||
shutil.rmtree(STAGING_DIR / job["uid"], ignore_errors=True)
|
shutil.rmtree(ZIP_STAGING_DIR / job["uid"], ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
def cmd_zips_prune(args):
|
def cmd_zips_prune(args):
|
||||||
|
|||||||
@@ -685,7 +685,6 @@ def import_from_dir(project_uid: str, src_dir, user: dict, *, skip_names=None) -
|
|||||||
|
|
||||||
|
|
||||||
def export_to_dir(project_uid: str, subpath: str, dest_dir) -> int:
|
def export_to_dir(project_uid: str, subpath: str, dest_dir) -> int:
|
||||||
_guard_writable(project_uid)
|
|
||||||
dest = Path(dest_dir).resolve()
|
dest = Path(dest_dir).resolve()
|
||||||
dest.mkdir(parents=True, exist_ok=True)
|
dest.mkdir(parents=True, exist_ok=True)
|
||||||
if subpath:
|
if subpath:
|
||||||
|
|||||||
@@ -5,21 +5,18 @@ import { OptimisticAction } from "./OptimisticAction.js";
|
|||||||
export class VoteManager extends OptimisticAction {
|
export class VoteManager extends OptimisticAction {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
document.addEventListener("click", (event) => this.onClick(event));
|
this.initVoteButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick(event) {
|
initVoteButtons() {
|
||||||
const button = event.target.closest('form[action^="/votes/"] button[type="submit"]');
|
document.querySelectorAll('form[action^="/votes/"] button[type="submit"]').forEach((button) => {
|
||||||
if (!button) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const form = button.closest("form");
|
const form = button.closest("form");
|
||||||
if (!form) {
|
button.addEventListener("click", (event) => {
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.cast(form, button);
|
this.cast(form, button);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cast(form, button) {
|
cast(form, button) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ def is_self(user, uid) -> bool:
|
|||||||
def guest_disabled(user) -> Markup:
|
def guest_disabled(user) -> Markup:
|
||||||
if user:
|
if user:
|
||||||
return Markup("")
|
return Markup("")
|
||||||
return Markup(' disabled aria-disabled="true" title="Log in to vote"')
|
return Markup(' disabled aria-disabled="true"')
|
||||||
|
|
||||||
|
|
||||||
def static_url(path) -> str:
|
def static_url(path) -> str:
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ def _init_db_fork_jobs():
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def fork_env(tmp_path, monkeypatch):
|
def fork_env(tmp_path, monkeypatch):
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"devplacepy.services.jobs.fork_service.STAGING_DIR", tmp_path / "staging"
|
"devplacepy.services.jobs.fork_service.FORK_STAGING_DIR", tmp_path / "staging"
|
||||||
)
|
)
|
||||||
monkeypatch.setattr("devplacepy.project_files.PROJECT_FILES_DIR", tmp_path / "pf")
|
monkeypatch.setattr("devplacepy.project_files.PROJECT_FILES_DIR", tmp_path / "pf")
|
||||||
yield tmp_path
|
yield tmp_path
|
||||||
|
|||||||
Reference in New Issue
Block a user