Skip to content

Commit

Permalink
Fix request_fill ajax endpoint not outputting JSON payload
Browse files Browse the repository at this point in the history
  • Loading branch information
itismadness committed Oct 4, 2021
1 parent fb94eac commit 97e989c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sections/ajax/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

$Action = $_GET['action'] ?? '';
if (isset($Aliases[$action])) {
$Action = $Aliases[$action];
$_GET['action'] = $Action = $Aliases[$action];
}
if (!$Action) {
json_die("failure");
Expand Down
7 changes: 6 additions & 1 deletion sections/requests/take_fill.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,18 @@ function search_joined_string($Haystack, $Needle, $Separator = '|', $Strict = tr
$SphQL->raw_query("UPDATE requests, requests_delta SET torrentid = $TorrentID, fillerid = $FillerID WHERE id = $RequestID", false);

if (defined('AJAX')) {
return [
$data = [
'requestId' => $RequestID,
'torrentId' => $TorrentID,
'fillerId' => $FillerID,
'fillerName' => $FillerUsername,
'bounty' => $RequestVotes['TotalBounty'],
];
if ($_GET['action'] === 'request_fill') {
json_print('success', $data);
} else {
return $data;
}
} else {
header("Location: requests.php?action=view&id=$RequestID");
}

0 comments on commit 97e989c

Please sign in to comment.