switch the order of message and chat notifs

master
Aevann 2024-04-18 18:24:19 +02:00
parent 0c92e9e071
commit 78a3b0aeaf
2 changed files with 12 additions and 12 deletions

View File

@ -823,18 +823,13 @@ class User(Base):
@lazy
def normal_notifications_count(self):
return self.notifications_count \
- self.chats_notifications_count \
- self.message_notifications_count \
- self.chats_notifications_count \
- self.modmail_notifications_count \
- self.post_notifications_count \
- self.modaction_notifications_count \
- self.offsite_notifications_count
@property
@lazy
def chats_notifications_count(self):
return g.db.query(ChatMembership).filter_by(user_id=self.id, notification=True).count()
@property
@lazy
def message_notifications_count(self):
@ -851,6 +846,11 @@ class User(Base):
return notifs.count()
@property
@lazy
def chats_notifications_count(self):
return g.db.query(ChatMembership).filter_by(user_id=self.id, notification=True).count()
@property
@lazy
def modmail_notifications_count(self):
@ -937,10 +937,10 @@ class User(Base):
# only meaningful when notifications_count > 0; otherwise falsely '' ~ normal
if self.normal_notifications_count > 0:
return ''
elif self.chats_notifications_count > 0:
return 'chats'
elif self.message_notifications_count > 0:
return 'messages'
elif self.chats_notifications_count > 0:
return 'chats'
elif self.modmail_notifications_count > 0:
return 'modmail'
elif self.post_notifications_count > 0:

View File

@ -15,13 +15,13 @@
</a>
</li>
<li class="nav-item">
<a class="nav-link py-3{% if request.path == '/notifications/chats' %} active{% endif %}" href="/notifications/chats">
Chats {% if v.chats_notifications_count %}<span class="font-weight-bold" style="color:#008080">({{v.chats_notifications_count}})</span>{% endif %}
<a class="nav-link py-3{% if request.path == '/notifications/messages' %} active{% endif %}" href="/notifications/messages">
Messages {% if v.message_notifications_count %}<span class="font-weight-bold" style="color:#d8910d">({{v.message_notifications_count}})</span>{% endif %}
</a>
</li>
<li class="nav-item">
<a class="nav-link py-3{% if request.path == '/notifications/messages' %} active{% endif %}" href="/notifications/messages">
Messages {% if v.message_notifications_count %}<span class="font-weight-bold" style="color:#d8910d">({{v.message_notifications_count}})</span>{% endif %}
<a class="nav-link py-3{% if request.path == '/notifications/chats' %} active{% endif %}" href="/notifications/chats">
Chats {% if v.chats_notifications_count %}<span class="font-weight-bold" style="color:#008080">({{v.chats_notifications_count}})</span>{% endif %}
</a>
</li>
{% if v.admin_level >= PERMS['VIEW_MODMAIL'] %}