Browse Source

Topic: add property to decide if user is "source"

This isn't meaningful yet, but we'll attach more logic shortly.
merge-requests/64/head
Deimos 6 years ago
parent
commit
263eb1bba0
  1. 5
      tildes/tildes/models/topic/topic.py
  2. 4
      tildes/tildes/templates/macros/topics.jinja2

5
tildes/tildes/models/topic/topic.py

@ -448,3 +448,8 @@ class Topic(DatabaseModel):
return f"<cite>@{authors[0]}:</cite><blockquote>{tweet}</blockquote>"
return None
@property
def is_user_treated_as_source(self) -> bool:
"""Return whether the user that posted the topic is its "source"."""
return self.is_text_type

4
tildes/tildes/templates/macros/topics.jinja2

@ -79,9 +79,9 @@
</a>
</div>
{% if topic.is_text_type %}
{% if topic.is_user_treated_as_source %}
<div aria-label="Posted by">{{ username_linked(topic.user.username) }}</div>
{% elif topic.is_link_type %}
{% else %}
<div aria-label="Link domain">{{ topic.link_domain }}</div>
{% endif %}

Loading…
Cancel
Save