Use reddit-style notifs without context
The notifications schema is already set up for reddit-style chronological notifications. We simply have to remove the logic that builds the context and patch up a few places in the frontend that were expecting full reply trees. `Comment.header_msg` previously expected the user's own comment to be top-level in comment replies. Logic is revised to expect the actual reply. `files.routes.front.notifications_main` now has reduced query volume because we aren't expiring the session when marking notifications read. This also allows us to remove the unused `comms` variable, which is a makeshift "pattern" of storing duplicate database replies across a commit so the templates don't requery (thus losing data attached to the runtime object, like `c.unread` / `c.notif_utc`). We move the `is_notification_page` flag to the route callers rather than templates checking `request.path`. Minor UI style: "Clear all notifications" -> "Mark All Read", since this was a persistent point of user confusion upstream, with people expecting their inbox to empty out. Also less margin between notifs to be consistent with tighter comment display elsewhere and removed need to separate groups of comments vs single comments.
This commit is contained in:
parent
695e6b6dbd
commit
6fde14a92c
4 changed files with 19 additions and 46 deletions
|
@ -10,7 +10,6 @@
|
|||
{%- set score = c.score_str(render_ctx) -%}
|
||||
{%- set downs = c.downvotes_str(render_ctx) -%}
|
||||
{% set replies = c.replies(v) %}
|
||||
{%- set is_notification_page = request.path.startswith('/notifications') -%}
|
||||
|
||||
{% if not c.visibility_state(v)[0] %}
|
||||
{% if c.show_descendants(v) %}
|
||||
|
@ -61,10 +60,10 @@
|
|||
{%- set voted = c.voted_display(v) -%}
|
||||
|
||||
{% if standalone and level==1 %}
|
||||
<div class="post-info post-row-cid-{{c.id}} mb-1 mr-2 {% if is_notification_page %}mt-5{% else %}mt-3{% endif %}">
|
||||
<div class="post-info post-row-cid-{{c.id}} mb-1 mr-2 mt-3">
|
||||
{% if c.post and c.post.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
<span class="align-top">
|
||||
<span class="font-weight-bold">{{c.header_msg(v, is_notification_page, replies | length) | safe}}</span>
|
||||
<span class="font-weight-bold">{{c.header_msg(v, is_notification_page) | safe}}</span>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue