forked from rDrama/rDrama
1
0
Fork 0

show referred_users in /settings/personal

master
Aevann 2023-09-15 18:20:04 +03:00
parent 5c6dcc9107
commit e33e0558f5
2 changed files with 16 additions and 1 deletions

View File

@ -176,7 +176,7 @@ class User(Base):
authorizations = relationship("ClientAuth", back_populates="user")
apps = relationship("OauthApp", back_populates="author")
awards = relationship("AwardRelationship", primaryjoin="User.id==AwardRelationship.user_id", back_populates="user")
referrals = relationship("User", primaryjoin="User.id==User.referred_by")
referrals = relationship("User", primaryjoin="User.id==User.referred_by", order_by="User.created_utc")
designed_hats = relationship("HatDef", primaryjoin="User.id==HatDef.author_id", back_populates="author")
owned_hats = relationship("Hat", back_populates="owners")
hats_equipped = relationship("Hat", lazy="raise", viewonly=True)

View File

@ -308,6 +308,21 @@
<div class="text-small text-muted mt-3">Share this link with a friend. {% if v.referral_count==0 %} When they sign up, you'll get the bronze recruitment badge. <a href="/badges">Learn more.</a>{% elif v.referral_count<10 %} When you refer 10 friends, you'll receive the silver recruitment badge. <a href="/badges">Learn more.</a>{% elif v.referral_count<100 %} When you refer 100 friends, you'll receive the gold recruitment badge. <a href="/badges">Learn more</a>.{% endif %}</div>
</div>
</div>
{% if v.referral_count %}
<div class="d-lg-flex border-bottom px-3">
<div class="title w-lg-25 px-0">
<label>Referred Users</label>
</div>
<table class="table">
{% for user in v.referrals %}
<tr>
<td>{% include "user_in_table.html" %}</td>
<td data-time="{{user.created_utc}}"></td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
</div>
</section>
</div>