forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-01-29 05:19:47 +02:00
parent 6311e06c75
commit 380f23d356
3 changed files with 14 additions and 4 deletions

View File

@ -548,6 +548,16 @@ class User(Base):
posts = g.db.query(Subscription.submission_id).filter_by(user_id=self.id).all()
return [x[0] for x in posts]
@property
@lazy
def saved_count(self):
return g.db.query(SaveRelationship.submission_id).filter(SaveRelationship.user_id == self.id).count()
@property
@lazy
def saved_comment_count(self):
return g.db.query(SaveRelationship.comment_id).filter(SaveRelationship.user_id == self.id).count()
@lazy
def saved_idlist(self, page=1):

View File

@ -609,10 +609,10 @@
</li>
{% if u.id == v.id %}
<li class="nav-item">
<a class="nav-link {% if 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important;" href="/@{{u.username}}/saved/posts">Saved Posts</a>
<a class="nav-link {% if 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important;" href="/@{{u.username}}/saved/posts">Saved Posts <span class="count">({{u.saved_count}})</span></a>
</li>
<li class="nav-item">
<a class="nav-link" style="font-size: .9rem !important; padding: .75rem .4rem !important;" href="/@{{u.username}}/saved/comments">Saved Comments</a>
<a class="nav-link" style="font-size: .9rem !important; padding: .75rem .4rem !important;" href="/@{{u.username}}/saved/comments">Saved Comments <span class="count">({{u.saved_comment_count}})</span></a>
</li>
{% endif %}
</ul>

View File

@ -14,10 +14,10 @@
</li>
{% if u.id == v.id %}
<li class="nav-item">
<a class="nav-link" style="font-size: .9rem !important; padding: .75rem .4rem !important;" href="/@{{u.username}}/saved/posts">Saved Posts</a>
<a class="nav-link" style="font-size: .9rem !important; padding: .75rem .4rem !important;" href="/@{{u.username}}/saved/posts">Saved Posts <span class="count">({{u.saved_count}})</span></a>
</li>
<li class="nav-item">
<a class="nav-link {% if 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important;" href="/@{{u.username}}/saved/comments">Saved Comments</a>
<a class="nav-link {% if 'saved' in request.path %}active{% endif %}" style="font-size: .9rem !important; padding: .75rem .4rem !important;" href="/@{{u.username}}/saved/comments">Saved Comments <span class="count">({{u.saved_comment_count}})</span></a>
</li>
{% endif %}
</ul>