Fixes handling of ratings in status views and urls

This commit is contained in:
Mouse Reeve 2021-02-25 15:05:51 -08:00
parent 2e36cfbcf6
commit 4a10c99026
4 changed files with 6 additions and 3 deletions

View file

@ -1,6 +1,6 @@
{% load bookwyrm_tags %}
<div class="block">
{% if status.status_type == 'Review' %}
{% if status.status_type == 'Review' or status.status_type == 'Rating' %}
<div>
<h3 class="title is-5 has-subtitle">
{% if status.name %}<span dir="auto">{{ status.name }}</span><br>{% endif %}

View file

@ -4,7 +4,7 @@
{% if status.status_type == 'GeneratedNote' %}
{{ status.content | safe }}
{% elif status.status_type == 'Review' and not status.name and not status.content%}
{% elif status.status_type == 'Rating' %}
rated
{% elif status.status_type == 'Review' %}
reviewed

View file

@ -13,6 +13,7 @@ local_user_path = r'^user/(?P<username>%s)' % regex.localname
status_types = [
'status',
'review',
'reviewrating',
'comment',
'quotation',
'boost',

View file

@ -56,7 +56,7 @@ class CreateStatus(View):
status.mention_users.set(set(status.mention_users.all()))
# don't apply formatting to generated notes
if not isinstance(status, models.GeneratedNote):
if not isinstance(status, models.GeneratedNote) and content:
status.content = to_markdown(content)
# do apply formatting to quotes
if hasattr(status, 'quote'):
@ -82,6 +82,8 @@ class DeleteStatus(View):
def find_mentions(content):
''' detect @mentions in raw status content '''
if not content:
return
for match in re.finditer(regex.strict_username, content):
username = match.group().strip().split('@')[1:]
if len(username) == 1: