Fix and improve admin/mod distinguishers (#386)

* Fix regression with comments from deleted mods

Starting with https://github.com/spikecodes/libreddit/pull/367/files
comments from deleted moderators and admins(?) aren't highlighted.

* Highlight mod and admin usernames in posts

Works like on reddit + shows highlight for mods on the search page.
This commit is contained in:
674Y3r 2022-01-09 03:50:53 +01:00 committed by GitHub
parent af6606a855
commit 91bff826f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@
{% if author.name != "[deleted]" %} {% if author.name != "[deleted]" %}
<a class="comment_author {{ author.distinguished }} {% if author.name == post_author %}op{% endif %}" href="/user/{{ author.name }}">u/{{ author.name }}</a> <a class="comment_author {{ author.distinguished }} {% if author.name == post_author %}op{% endif %}" href="/user/{{ author.name }}">u/{{ author.name }}</a>
{% else %} {% else %}
<span class="comment_author">u/[deleted]</span> <span class="comment_author {{ author.distinguished }}">u/[deleted]</span>
{% endif %} {% endif %}
{% if author.flair.flair_parts.len() > 0 %} {% if author.flair.flair_parts.len() > 0 %}
<small class="author_flair">{% call utils::render_flair(author.flair.flair_parts) %}</small> <small class="author_flair">{% call utils::render_flair(author.flair.flair_parts) %}</small>

View File

@ -37,7 +37,7 @@
<p class="post_header"> <p class="post_header">
<a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a> <a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a>
<span class="dot">&bull;</span> <span class="dot">&bull;</span>
<a class="post_author" href="/user/{{ post.author.name }}">u/{{ post.author.name }}</a> <a class="post_author {{ post.author.distinguished }}" href="/user/{{ post.author.name }}">u/{{ post.author.name }}</a>
{% if post.author.flair.flair_parts.len() > 0 %} {% if post.author.flair.flair_parts.len() > 0 %}
<small class="author_flair">{% call utils::render_flair(post.author.flair.flair_parts) %}</small> <small class="author_flair">{% call utils::render_flair(post.author.flair.flair_parts) %}</small>
{% endif %} {% endif %}

View File

@ -72,7 +72,7 @@
{% endif -%} {% endif -%}
<a class="post_subreddit" href="/{{ community }}">{{ community }}</a> <a class="post_subreddit" href="/{{ community }}">{{ community }}</a>
<span class="dot">&bull;</span> <span class="dot">&bull;</span>
<a class="post_author" href="/u/{{ post.author.name }}">u/{{ post.author.name }}</a> <a class="post_author {{ post.author.distinguished }}" href="/u/{{ post.author.name }}">u/{{ post.author.name }}</a>
<span class="dot">&bull;</span> <span class="dot">&bull;</span>
<span class="created" title="{{ post.created }}">{{ post.rel_time }}</span> <span class="created" title="{{ post.created }}">{{ post.rel_time }}</span>
{% if !post.awards.is_empty() %} {% if !post.awards.is_empty() %}