always use author_name even if its not needed for consistency

pull/136/head
Aevann 2023-03-01 21:28:10 +02:00
parent c3514822d1
commit b3f75b9beb
10 changed files with 15 additions and 18 deletions

View File

@ -178,7 +178,7 @@ class Comment(Base):
@property
@lazy
def author_name(self):
if self.ghost: return '👻'
if self.ghost and self.id != g.v.id: return '👻'
return self.author.user_name
@lazy

View File

@ -140,7 +140,7 @@ class Submission(Base):
@property
@lazy
def author_name(self):
if self.ghost: return '👻'
if self.ghost and self.id != g.v.id: return '👻'
return self.author.user_name
@property

View File

@ -90,7 +90,7 @@ def notif_comment(text):
def notif_comment2(p):
text = f"@{p.author.username} has mentioned you: [{p.title}](/post/{p.id})"
text = f"@{p.author_name} has mentioned you: [{p.title}](/post/{p.id})"
search_html = f'%</a> has mentioned you: <a href="/post/{p.id}">%'

View File

@ -169,10 +169,7 @@ def award_thing(v, thing_type, id):
note = request.values.get("note", "").strip()
if thing.ghost and v.id != author.id:
safe_username = "👻"
else:
safe_username = f"@{author.username}"
safe_username = f"@{thing.author_name}"
if SITE == 'rdrama.net' and author.id in {PIZZASHILL_ID, CARP_ID}:
abort(403, f"{safe_username} is immune to awards!")

View File

@ -166,7 +166,7 @@ def move_post(post:Submission, v:User, reason:str) -> Union[bool, str]:
if v.id == post.author_id:
abort(403, f"You need to be a member of House {sub_to.capitalize()} to post in /h/{sub_to}")
else:
abort(403, f"@{post.author.username} needs to be a member of House {sub_to.capitalize()} for their post to be moved to /h/{sub_to}")
abort(403, f"@{post.author_name} needs to be a member of House {sub_to.capitalize()} for their post to be moved to /h/{sub_to}")
post.sub = sub_to
post.hole_pinned = None

View File

@ -431,9 +431,9 @@
{% endif %}
{% if v.id != c.author_id and not c.ghost %}
<button type="button" id="unblock-{{c.id}}" class="dropdown-item text-success list-inline-item {% if not c.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/unblock?username={{c.author.username}}','block-{{c.id}}','unblock-{{c.id}}','d-none')"><i class="fas fa-eye text-success"></i>Unblock user</button>
<button type="button" id="unblock-{{c.id}}" class="dropdown-item text-success list-inline-item {% if not c.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/unblock?username={{c.author_name}}','block-{{c.id}}','unblock-{{c.id}}','d-none')"><i class="fas fa-eye text-success"></i>Unblock user</button>
<button type="button" id="block-{{c.id}}" class="dropdown-item list-inline-item text-danger {% if c.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/block?username={{c.author.username}}','block-{{c.id}}','unblock-{{c.id}}','d-none')"><i class="fas fa-eye-slash text-danger"></i>Block user</button>
<button type="button" id="block-{{c.id}}" class="dropdown-item list-inline-item text-danger {% if c.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/block?username={{c.author_name}}','block-{{c.id}}','unblock-{{c.id}}','d-none')"><i class="fas fa-eye-slash text-danger"></i>Block user</button>
{% endif %}
{% if c.parent_submission %}
@ -610,9 +610,9 @@
{% endif %}
{% if not c.ghost %}
<button type="button" id="unblock2-{{c.id}}" data-bs-dismiss="modal" class="text-success list-group-item {% if not c.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/unblock?username={{c.author.username}}','block2-{{c.id}}','unblock2-{{c.id}}','d-none')"><i class="fas fa-eye-slash text-success mr-2"></i>Unblock user</button>
<button type="button" id="unblock2-{{c.id}}" data-bs-dismiss="modal" class="text-success list-group-item {% if not c.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/unblock?username={{c.author_name}}','block2-{{c.id}}','unblock2-{{c.id}}','d-none')"><i class="fas fa-eye-slash text-success mr-2"></i>Unblock user</button>
<button type="button" id="block2-{{c.id}}" class="{% if c.is_blocking %}d-none{% endif %} list-group-item text-danger" data-areyousure="postToastSwitch(this,'/settings/block?username={{c.author.username}}','block2-{{c.id}}','unblock2-{{c.id}}','d-none')" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-dismiss="modal"><i class="fas fa-eye-slash fa-fw text-danger mr-2"></i>Block user</button>
<button type="button" id="block2-{{c.id}}" class="{% if c.is_blocking %}d-none{% endif %} list-group-item text-danger" data-areyousure="postToastSwitch(this,'/settings/block?username={{c.author_name}}','block2-{{c.id}}','unblock2-{{c.id}}','d-none')" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-dismiss="modal"><i class="fas fa-eye-slash fa-fw text-danger mr-2"></i>Block user</button>
{% endif %}
{% endif %}

View File

@ -6,7 +6,7 @@
<h3 class="mt-5">{{thing.body_html | safe}} - {{ups | length}} {% if thing.exclusive == 2 %}bets{% else %}votes{% endif %}</h3>
<p><b>Link:</b> <a href="{{thing.parent.permalink}}">{{thing.parent.permalink}}</a></p>
<p><b>Author:</b> <a href="{{thing.parent.url}}">@{{thing.parent.author.username}}</a></p>
<p><b>Author:</b> <a href="{{thing.parent.url}}">@{{thing.parent.author_name}}</a></p>
<p><b>Author Created At:</b> <span data-time="{{thing.parent.author.created_utc}}"></span></p>
<p><b>Author Truescore:</b> {{"{:,}".format(thing.parent.author.truescore)}}</p>
<p><b>Total voter truescore: </b>{{total_ts}}</p>

View File

@ -64,8 +64,8 @@
<button type="button" id="approve-{{p.id}}" class="dropdown-item {% if not p.is_banned and request.path != '/admin/reported/posts' %}d-none{% endif %} list-inline-item text-success" data-nonce="{{g.nonce}}" data-onclick="approvePost(this,'{{p.id}}','remove-{{p.id}}','approve-{{p.id}}','d-none')"><i class="fas fa-check"></i>Approve</button>
{% endif %}
{% if v.id != p.author_id and not p.ghost %}
<button type="button" id="unblock-{{p.id}}" class="dropdown-item text-success list-inline-item {% if not p.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/unblock?username={{p.author.username}}','block-{{p.id}}','unblock-{{p.id}}','d-none')"><i class="fas fa-eye text-success"></i>Unblock user</button>
<button type="button" id="block-{{p.id}}" class="dropdown-item list-inline-item text-danger {% if p.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/block?username={{p.author.username}}','block-{{p.id}}','unblock-{{p.id}}','d-none')"><i class="fas fa-eye-slash text-danger"></i>Block user</button>
<button type="button" id="unblock-{{p.id}}" class="dropdown-item text-success list-inline-item {% if not p.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/unblock?username={{p.author_name}}','block-{{p.id}}','unblock-{{p.id}}','d-none')"><i class="fas fa-eye text-success"></i>Unblock user</button>
<button type="button" id="block-{{p.id}}" class="dropdown-item list-inline-item text-danger {% if p.is_blocking %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/block?username={{p.author_name}}','block-{{p.id}}','unblock-{{p.id}}','d-none')"><i class="fas fa-eye-slash text-danger"></i>Block user</button>
{% endif %}
{% if v.id != p.author_id and p.sub %}
<button type="button" id="unblock-sub-{{p.id}}" class="dropdown-item text-success list-inline-item {% if not v.blocks(p.sub) %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/h/{{p.sub}}/unblock','block-sub-{{p.id}}','unblock-sub-{{p.id}}','d-none')"><i class="fas fa-eye text-success"></i>Unblock /h/{{p.sub}}</button>

View File

@ -43,8 +43,8 @@
<button type="button" id="delete-{{p.id}}" class="{% if p.deleted_utc %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deletePostModal" data-nonce="{{g.nonce}}" data-onclick="delete_postModal(this, '{{p.id}}')"><i class="far fa-trash-alt mr-2"></i>Delete</button>
{% else %}
{% if not p.ghost %}
<button type="button" id="unblock2-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-success text-left {% if not p.is_blocking %}d-none{% endif %}" data-bs-dismiss="modal" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/unblock?username={{p.author.username}}','block2-{{p.id}}','unblock2-{{p.id}}','d-none')"><i class="fas fa-eye mr-2 text-success"></i>Unblock user</button>
<button type="button" id="block2-{{p.id}}" class="blockuser nobackground btn btn-link btn-block btn-lg text-danger text-left" data-areyousure="postToastSwitch(this,'/settings/block?username={{p.author.username}}','block2-{{p.id}}','unblock2-{{p.id}}','d-none')" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-dismiss="modal"><i class="fas fa-eye-slash mr-2 text-danger"></i>Block user</button>
<button type="button" id="unblock2-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-success text-left {% if not p.is_blocking %}d-none{% endif %}" data-bs-dismiss="modal" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/settings/unblock?username={{p.author_name}}','block2-{{p.id}}','unblock2-{{p.id}}','d-none')"><i class="fas fa-eye mr-2 text-success"></i>Unblock user</button>
<button type="button" id="block2-{{p.id}}" class="blockuser nobackground btn btn-link btn-block btn-lg text-danger text-left" data-areyousure="postToastSwitch(this,'/settings/block?username={{p.author_name}}','block2-{{p.id}}','unblock2-{{p.id}}','d-none')" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-dismiss="modal"><i class="fas fa-eye-slash mr-2 text-danger"></i>Block user</button>
{% endif %}
{% if p.sub %}
<button type="button" id="unblock-sub2-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-success text-left {% if not v.blocks(p.sub) %}d-none{% endif %}" data-bs-dismiss="modal" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/h/{{p.sub}}/unblock','block-sub2-{{p.id}}','unblock-sub2-{{p.id}}','d-none')"><i class="fas fa-eye mr-2 text-success"></i>Unblock /h/{{p.sub}}</button>

View File

@ -4,7 +4,7 @@
{% if thing %}
<h1 class="mt-2">Info</h1>
<p><a href="{{thing.permalink}}">{{thing.permalink}}</a></p>
<p><b>Author:</b> <a href="{{thing.author.url}}">@{{thing.author.username}}</a></p>
<p><b>Author:</b> <a href="{{thing.author.url}}">@{{thing.author_name}}</a></p>
<p><b>Author Created At:</b> <span data-time="{{thing.author.created_utc}}"></span></p>
<p><b>Author Truescore:</b> {{"{:,}".format(thing.author.truescore)}}</p>
<p><b>Upvotes: </b>{{ups | length}}</p>