Browse Source

Adjust info shown for topics posted by scheduler

Previously, scheduled topics just had "Tildes" in place of the name of
the user that posted them, which wasn't very clear. This is a little
more explicit, and uses some different styling for that info on topics
when shown in listings.
merge-requests/87/merge
Deimos 5 years ago
parent
commit
9f3f6687ce
  1. 4
      tildes/scss/modules/_topic.scss
  2. 4
      tildes/scss/themes/_theme_base.scss
  3. 5
      tildes/tildes/models/topic/topic.py
  4. 17
      tildes/tildes/templates/macros/topics.jinja2
  5. 13
      tildes/tildes/templates/topic.jinja2

4
tildes/scss/modules/_topic.scss

@ -253,6 +253,10 @@
text-overflow: ellipsis;
}
.topic-info-source-scheduled {
font-style: italic;
}
.topic-full {
.topic-voting {
float: right;

4
tildes/scss/themes/_theme_base.scss

@ -546,6 +546,10 @@
color: map-get($theme, "alert");
}
.topic-info-source-scheduled {
color: map-get($theme, "foreground-secondary");
}
.topic-log-entry-time {
color: map-get($theme, "foreground-secondary");
}

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

@ -591,3 +591,8 @@ class Topic(DatabaseModel):
return True
return self.is_text_type
@property
def was_posted_by_scheduler(self) -> bool:
"""Return whether this topic was posted automatically by the topic scheduler."""
return bool(self.schedule_id)

17
tildes/tildes/templates/macros/topics.jinja2

@ -90,20 +90,25 @@
</a>
</div>
<div class="topic-info-source"
{% if topic.is_user_treated_as_source %}
aria-label="Posted by">{{ link_to_user(topic.user) }}
{% if topic.was_posted_by_scheduler and topic.user_id == -1 %}
<div class="topic-info-source topic-info-source-scheduled">
Scheduled topic
</div>
{% else %}
<div class="topic-info-source" aria-label="Posted by">
{{ link_to_user(topic.user) }}
</div>
{% endif %}
{% else %}
aria-label="Link source"
title="{{ topic.link_domain }}"
>
<div class="topic-info-source" aria-label="Link source" title="{{ topic.link_domain }}">
{% if topic.is_link_type %}
<div class="topic-icon topic-icon-{{ topic.link_domain.replace('.', '_') }}"></div>
{% endif %}
{{ topic.link_source }}
</div>
{% endif %}
</div>
<div aria-label="Post time">{{ adaptive_date_responsive(topic.created_time, precision=1) }}</div>
</footer>

13
tildes/tildes/templates/topic.jinja2

@ -35,11 +35,16 @@
<header>
{{ topic_voting(topic) }}
<h1>{{ topic.title }}</h1>
<div class="topic-full-byline">Posted {{ adaptive_date_responsive(topic.created_time) }} by
{% if request.has_permission('view_author', topic) %}
{{ link_to_user(topic.user) }}
<div class="topic-full-byline">
{% if topic.was_posted_by_scheduler and topic.user_id == -1 %}
Automatically posted {{ adaptive_date_responsive(topic.created_time) }}
{% else %}
unknown user
Posted {{ adaptive_date_responsive(topic.created_time) }} by
{% if request.has_permission('view_author', topic) %}
{{ link_to_user(topic.user) }}
{% else %}
unknown user
{% endif %}
{% endif %}
{% if topic.last_edited_time %}

Loading…
Cancel
Save