show username
This commit is contained in:
parent
9631ddc7e5
commit
cf46065635
|
@ -1,7 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PaymentSerializer < ApplicationSerializer
|
||||
attributes :payment_intent_id, :receipt_email, :url, :created_at_age, :amount, :amount_currency
|
||||
attributes :payment_intent_id,
|
||||
:receipt_email,
|
||||
:url,
|
||||
:created_at_age,
|
||||
:amount,
|
||||
:amount_currency,
|
||||
:username
|
||||
|
||||
def created_at_age
|
||||
Time.now - object.created_at
|
||||
|
@ -15,8 +21,20 @@ class PaymentSerializer < ApplicationSerializer
|
|||
)
|
||||
end
|
||||
|
||||
def username
|
||||
user&.username
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user
|
||||
begin
|
||||
User.find(object.user_id)
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def currency_unit
|
||||
case object.currency
|
||||
when "eur"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
<h3>{{i18n 'discourse_patrons.title' site_name=siteSettings.title}}</h3>
|
||||
<h2>{{i18n 'discourse_patrons.title' site_name=siteSettings.title}}</h2>
|
||||
|
||||
<table class="table discourse_patrons_admin">
|
||||
<thead>
|
||||
|
@ -13,7 +13,7 @@
|
|||
</thead>
|
||||
{{#each model as |payment|}}
|
||||
<tr>
|
||||
<td>{{payment.user_id}}</td>
|
||||
<td>{{payment.username}}</td>
|
||||
<td>{{{stripe-payment-link payment}}}</td>
|
||||
<td>{{payment.receipt_email}}</td>
|
||||
<td>{{{format-duration payment.created_at_age}}}</td>
|
||||
|
|
Loading…
Reference in New Issue