forked from mirrors/bookwyrm
Fixes handling of ratings in status views and urls
This commit is contained in:
parent
2e36cfbcf6
commit
4a10c99026
4 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
<div class="block">
|
<div class="block">
|
||||||
{% if status.status_type == 'Review' %}
|
{% if status.status_type == 'Review' or status.status_type == 'Rating' %}
|
||||||
<div>
|
<div>
|
||||||
<h3 class="title is-5 has-subtitle">
|
<h3 class="title is-5 has-subtitle">
|
||||||
{% if status.name %}<span dir="auto">{{ status.name }}</span><br>{% endif %}
|
{% if status.name %}<span dir="auto">{{ status.name }}</span><br>{% endif %}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
{% if status.status_type == 'GeneratedNote' %}
|
{% if status.status_type == 'GeneratedNote' %}
|
||||||
{{ status.content | safe }}
|
{{ status.content | safe }}
|
||||||
{% elif status.status_type == 'Review' and not status.name and not status.content%}
|
{% elif status.status_type == 'Rating' %}
|
||||||
rated
|
rated
|
||||||
{% elif status.status_type == 'Review' %}
|
{% elif status.status_type == 'Review' %}
|
||||||
reviewed
|
reviewed
|
||||||
|
|
|
@ -13,6 +13,7 @@ local_user_path = r'^user/(?P<username>%s)' % regex.localname
|
||||||
status_types = [
|
status_types = [
|
||||||
'status',
|
'status',
|
||||||
'review',
|
'review',
|
||||||
|
'reviewrating',
|
||||||
'comment',
|
'comment',
|
||||||
'quotation',
|
'quotation',
|
||||||
'boost',
|
'boost',
|
||||||
|
|
|
@ -56,7 +56,7 @@ class CreateStatus(View):
|
||||||
status.mention_users.set(set(status.mention_users.all()))
|
status.mention_users.set(set(status.mention_users.all()))
|
||||||
|
|
||||||
# don't apply formatting to generated notes
|
# 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)
|
status.content = to_markdown(content)
|
||||||
# do apply formatting to quotes
|
# do apply formatting to quotes
|
||||||
if hasattr(status, 'quote'):
|
if hasattr(status, 'quote'):
|
||||||
|
@ -82,6 +82,8 @@ class DeleteStatus(View):
|
||||||
|
|
||||||
def find_mentions(content):
|
def find_mentions(content):
|
||||||
''' detect @mentions in raw status content '''
|
''' detect @mentions in raw status content '''
|
||||||
|
if not content:
|
||||||
|
return
|
||||||
for match in re.finditer(regex.strict_username, content):
|
for match in re.finditer(regex.strict_username, content):
|
||||||
username = match.group().strip().split('@')[1:]
|
username = match.group().strip().split('@')[1:]
|
||||||
if len(username) == 1:
|
if len(username) == 1:
|
||||||
|
|
Loading…
Reference in a new issue