mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-13 05:26:47 +00:00
feat: filter payment tags in profile view
This commit introduces a filter for payment tags in the association profile view. This filter ensures that only the payments with the current public key are shown. Minor adjustments are also made in the JSON_THROW_ON_ERROR and the comparison of year and amount in the currentYearIsPaid method.
This commit is contained in:
@@ -98,7 +98,10 @@ $searchPaymentEvent = function () {
|
||||
'pubkey' => $event->event->pubkey,
|
||||
'tags' => $event->event->tags,
|
||||
'created_at' => $event->event->created_at,
|
||||
])->toArray();
|
||||
])
|
||||
->filter(fn($payment) => collect($payment['tags'])->firstWhere('0', 'p')[1] === $this->currentPubkey)
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
$this->yearsPaid = collect($this->payments)->map(fn($payment)
|
||||
=> [
|
||||
@@ -108,13 +111,13 @@ $searchPaymentEvent = function () {
|
||||
collect($payment['tags'])->firstWhere('0', 'description')[1],
|
||||
true,
|
||||
512,
|
||||
JSON_THROW_ON_ERROR
|
||||
)['tags']
|
||||
JSON_THROW_ON_ERROR,
|
||||
)['tags'],
|
||||
)->firstWhere('0', 'amount')[1] / 1000,
|
||||
]);
|
||||
|
||||
$this->currentYearIsPaid = collect($this->yearsPaid)->contains(
|
||||
fn($yearPaid) => $yearPaid['year'] == date('Y') && $yearPaid['amount'] == $this->amountToPay
|
||||
fn($yearPaid) => $yearPaid['year'] == date('Y') && $yearPaid['amount'] == $this->amountToPay,
|
||||
);
|
||||
|
||||
$this->paid = true;
|
||||
|
||||
Reference in New Issue
Block a user