Skip to content
Permalink
Browse files

Fix being unable to remove asset previews, fix SQL error when editing

  • Loading branch information...
bojidar-bg committed Mar 17, 2019
1 parent a52acd0 commit 8d03dc9bec0ca61a4e3d21aaf517245e6082cf37
Showing with 3 additions and 2 deletions.
  1. +1 −1 src/queries.php
  2. +2 −1 src/routes/asset_edit.php
@@ -162,7 +162,7 @@
'submit' => 'INSERT INTO `as_asset_edits`
SET asset_id=:asset_id, user_id=:user_id, title=:title, description=:description, category_id=:category_id, godot_version=:godot_version, version_string=:version_string,
cost=:cost, download_provider=:download_provider, download_commit=:download_commit, browse_url=:browse_url, issues_url=:issues_url, icon_url=:icon_url,
status=0, submit_date=NOW()',
status=0, reason="", submit_date=NOW()',
'update' => 'UPDATE `as_asset_edits`
SET title=:title, description=:description, category_id=:category_id, godot_version=:godot_version, version_string=:version_string, cost=:cost,
@@ -4,6 +4,7 @@
function _submit_asset_edit($c, $response, $body, $user_id, $asset_id=-1)
{
$has_changes = false;
$asset = null;
$query = $c->queries['asset_edit']['submit'];
$query->bindValue(':user_id', $user_id, PDO::PARAM_INT);
@@ -44,7 +45,7 @@ function _submit_asset_edit($c, $response, $body, $user_id, $asset_id=-1)
$id = $c->db->lastInsertId();
if (isset($body['previews'])) {
$error = _add_previews_to_edit($c, $error, $response, $id, $body['previews'], null, $asset_id==-1, $has_changes);
$error = _add_previews_to_edit($c, $error, $response, $id, $body['previews'], $asset, $asset_id==-1, $has_changes);
if (!$has_changes && $asset_id != -1) {
$response = $response->withJson([

0 comments on commit 8d03dc9

Please sign in to comment.
You can’t perform that action at this time.