Browse Source

Fix duplication of "published" in metadata display

merge-requests/85/head
Deimos 5 years ago
parent
commit
9228616c4a
  1. 3
      tildes/tildes/enums.py
  2. 7
      tildes/tildes/models/topic/topic.py

3
tildes/tildes/enums.py

@ -140,8 +140,7 @@ class ContentMetadataFields(enum.Enum):
if self.name == "PUBLISHED":
published = utc_from_timestamp(value)
date_str = published.strftime("%b %-d %Y")
return f"published {date_str}"
return published.strftime("%b %-d %Y")
if self.name == "WORD_COUNT":
if value == 1:

7
tildes/tildes/models/topic/topic.py

@ -515,7 +515,12 @@ class Topic(DatabaseModel):
if self.created_time - published < timedelta(days=3):
continue
metadata_strings.append(field.format_value(value))
formatted_value = field.format_value(value)
if field is ContentMetadataFields.PUBLISHED:
formatted_value = f"published {formatted_value}"
metadata_strings.append(formatted_value)
return ", ".join(metadata_strings)

Loading…
Cancel
Save