Merge pull request #6864 from firefly-iii/update-build-2

Update build 2
This commit is contained in:
James Cole 2023-01-15 17:31:35 +01:00 committed by GitHub
commit bc47017e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 9 deletions

View File

@ -104,6 +104,7 @@ class DeleteController extends Controller
*/ */
public function destroy(TransactionGroup $group): RedirectResponse public function destroy(TransactionGroup $group): RedirectResponse
{ {
Log::debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
if (!$this->isEditableGroup($group)) { if (!$this->isEditableGroup($group)) {
return $this->redirectGroupToAccount($group); return $this->redirectGroupToAccount($group);
} }

View File

@ -98,17 +98,23 @@ class MassController extends Controller
*/ */
public function destroy(MassDeleteJournalRequest $request) public function destroy(MassDeleteJournalRequest $request)
{ {
Log::debug(sprintf('Now in %s', __METHOD__));
$ids = $request->get('confirm_mass_delete'); $ids = $request->get('confirm_mass_delete');
$count = 0; $count = 0;
if (is_array($ids)) { if (is_array($ids)) {
Log::debug('Array of IDs', $ids);
/** @var string $journalId */ /** @var string $journalId */
foreach ($ids as $journalId) { foreach ($ids as $journalId) {
Log::debug(sprintf('Searching for ID #%d', $journalId));
/** @var TransactionJournal $journal */ /** @var TransactionJournal $journal */
$journal = $this->repository->find((int)$journalId); $journal = $this->repository->find((int)$journalId);
if (null !== $journal && (int)$journalId === $journal->id) { if (null !== $journal && (int)$journalId === (int) $journal->id) {
$this->repository->destroyJournal($journal); $this->repository->destroyJournal($journal);
++$count; ++$count;
Log::debug(sprintf('Deleted transaction journal #%d', $journalId));
continue;
} }
Log::debug(sprintf('Could not find transaction journal #%d', $journalId));
} }
} }
app('preferences')->mark(); app('preferences')->mark();

View File

@ -32,6 +32,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder; use Illuminate\Database\Query\Builder;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
@ -94,18 +95,22 @@ class TransactionGroup extends Model
*/ */
public static function routeBinder(string $value): TransactionGroup public static function routeBinder(string $value): TransactionGroup
{ {
Log::debug(sprintf('Now in %s("%s")', __METHOD__, $value));
if (auth()->check()) { if (auth()->check()) {
$groupId = (int)$value; $groupId = (int)$value;
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
Log::debug(sprintf('User authenticated as %s', $user->email));
/** @var TransactionGroup $group */ /** @var TransactionGroup $group */
$group = $user->transactionGroups() $group = $user->transactionGroups()
->with(['transactionJournals', 'transactionJournals.transactions']) ->with(['transactionJournals', 'transactionJournals.transactions'])
->where('transaction_groups.id', $groupId)->first(['transaction_groups.*']); ->where('transaction_groups.id', $groupId)->first(['transaction_groups.*']);
if (null !== $group) { if (null !== $group) {
Log::debug(sprintf('Found group #%d.', $group->id));
return $group; return $group;
} }
} }
Log::debug('Found no group.');
throw new NotFoundHttpException(); throw new NotFoundHttpException();
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -529,7 +529,7 @@ export default {
// if count is 0, send user onwards. // if count is 0, send user onwards.
if (this.createAnother) { if (this.createAnother) {
// do message: // do message:
this.success_message = this.$t('firefly.transaction_stored_link', {ID: groupId, title: title}); this.success_message = this.$t('firefly.transaction_stored_link', {ID: groupId, title: $(title).text()});
this.error_message = ''; this.error_message = '';
if (this.resetFormAfter) { if (this.resetFormAfter) {
// also clear form. // also clear form.

View File

@ -140,7 +140,7 @@ export default {
// post! // post!
axios.post('./api/v1/webhooks', data).then((response) => { axios.post('./api/v1/webhooks', data).then((response) => {
this.success_message = response.data.message; this.success_message = $.text(response.data.message);
// console.log('Will now go to redirectUser()'); // console.log('Will now go to redirectUser()');
let webhookId = response.data.data.id; let webhookId = response.data.data.id;
window.location.href = window.previousUrl + '?webhook_id=' + webhookId + '&message=created'; window.location.href = window.previousUrl + '?webhook_id=' + webhookId + '&message=created';

View File

@ -187,7 +187,7 @@ export default {
// post! // post!
axios.put('./api/v1/webhooks/' + this.id, data).then((response) => { axios.put('./api/v1/webhooks/' + this.id, data).then((response) => {
this.success_message = response.data.message; this.success_message = $.text(response.data.message);
// console.log('Will now go to redirectUser()'); // console.log('Will now go to redirectUser()');
let webhookId = response.data.data.id; let webhookId = response.data.data.id;
window.location.href = window.previousUrl + '?webhook_id=' + webhookId + '&message=updated'; window.location.href = window.previousUrl + '?webhook_id=' + webhookId + '&message=updated';

View File

@ -290,7 +290,7 @@ export default {
let button = $('#triggerButton'); let button = $('#triggerButton');
button.prop('disabled', true).addClass('disabled'); button.prop('disabled', true).addClass('disabled');
this.success_message = this.$t('firefly.webhook_was_triggered'); this.success_message = $.text(this.$t('firefly.webhook_was_triggered'));
// TODO actually trigger the webhook. // TODO actually trigger the webhook.
axios.post('./api/v1/webhooks/' + this.id + '/trigger-transaction/' + journalId, {}); axios.post('./api/v1/webhooks/' + this.id + '/trigger-transaction/' + journalId, {});
button.prop('disabled', false).removeClass('disabled'); button.prop('disabled', false).removeClass('disabled');