''' note serializer and children thereof '''
from dataclasses import dataclass, field
from typing import Dict, List

from .base_activity import ActivityObject, Link
from .image import Image

@dataclass(init=False)
class Tombstone(ActivityObject):
    ''' the placeholder for a deleted status '''
    published: str
    deleted: str
    type: str = 'Tombstone'


@dataclass(init=False)
class Note(ActivityObject):
    ''' Note activity '''
    published: str
    attributedTo: str
    content: str
    to: List[str] = field(default_factory=lambda: [])
    cc: List[str] = field(default_factory=lambda: [])
    replies: Dict = field(default_factory=lambda: {})
    inReplyTo: str = ''
    summary: str = ''
    tag: List[Link] = field(default_factory=lambda: [])
    attachment: List[Image] = field(default_factory=lambda: [])
    sensitive: bool = False
    type: str = 'Note'


@dataclass(init=False)
class Article(Note):
    ''' what's an article except a note with more fields '''
    name: str
    type: str = 'Article'


@dataclass(init=False)
class GeneratedNote(Note):
    ''' just a re-typed note '''
    type: str = 'GeneratedNote'


@dataclass(init=False)
class Comment(Note):
    ''' like a note but with a book '''
    inReplyToBook: str
    type: str = 'Comment'


@dataclass(init=False)
class Review(Comment):
    ''' a full book review '''
    name: str
    rating: int = None
    type: str = 'Review'


@dataclass(init=False)
class Quotation(Comment):
    ''' a quote and commentary on a book '''
    quote: str
    type: str = 'Quotation'

bookwyrm/activitypub/note.py
''' note serializer and children thereof '''
from dataclasses import dataclass, field
from typing import Dict, List

from .base_activity import ActivityObject, Link
from .image import Image

@dataclass(init=False)
class Tombstone(ActivityObject):
    ''' the placeholder for a deleted status '''
    published: str
    deleted: str
    type: str = 'Tombstone'


@dataclass(init=False)
class Note(ActivityObject):
    ''' Note activity '''
    published: str
    attributedTo: str
    content: str
    to: List[str] = field(default_factory=lambda: [])
    cc: List[str] = field(default_factory=lambda: [])
    replies: Dict = field(default_factory=lambda: {})
    inReplyTo: str = ''
    summary: str = ''
    tag: List[Link] = field(default_factory=lambda: [])
    attachment: List[Image] = field(default_factory=lambda: [])
    sensitive: bool = False
    type: str = 'Note'


@dataclass(init=False)
class Article(Note):
    ''' what's an article except a note with more fields '''
    name: str
    type: str = 'Article'


@dataclass(init=False)
class GeneratedNote(Note):
    ''' just a re-typed note '''
    type: str = 'GeneratedNote'


@dataclass(init=False)
class Comment(Note):
    ''' like a note but with a book '''
    inReplyToBook: str
    type: str = 'Comment'


@dataclass(init=False)
class Review(Comment):
    ''' a full book review '''
    name: str = None
    rating: int = None
    type: str = 'Review'


@dataclass(init=False)
class Quotation(Comment):
    ''' a quote and commentary on a book '''
    quote: str
    type: str = 'Quotation'

bookwyrm/activitypub/note.py
diff --git a/bookwyrm/activitypub/note.py b/bookwyrm/activitypub/note.py
index b478c96dda..72fbe5fc2d 100644
--- a/bookwyrm/activitypub/note.py
+++ b/bookwyrm/activitypub/note.py
@@ -53,7 +53,7 @@ class Comment(Note):
 @dataclass(init=False)
 class Review(Comment):
     ''' a full book review '''
-    name: str
+    name: str = None
     rating: int = None
     type: str = 'Review'
 
diff --git a/bookwyrm/templates/snippets/content_warning_field.html b/bookwyrm/templates/snippets/content_warning_field.html
index e2f561f241..9249602af1 100644
--- a/bookwyrm/templates/snippets/content_warning_field.html
+++ b/bookwyrm/templates/snippets/content_warning_field.html
@@ -1,4 +1,5 @@
-{% with uuid as uuid %}
+{% load bookwyrm_tags %}
+{% with 0|uuid as uuid %}
 <div class="control">
     <div>
         <input type="radio" class="toggle-control" name="sensitive" value="false" id="hide-spoilers-{{ uuid }}" {% if not parent_status.content_warning %}checked{% endif %}>
diff --git a/bookwyrm/templates/snippets/rate_action.html b/bookwyrm/templates/snippets/rate_action.html
index b9c443ce57..49cb87ed69 100644
--- a/bookwyrm/templates/snippets/rate_action.html
+++ b/bookwyrm/templates/snippets/rate_action.html
@@ -4,7 +4,9 @@
     {% for i in '12345'|make_list %}
     <form name="rate" action="/rate/" method="POST" onsubmit="return rate_stars(event)">
         {% csrf_token %}
+        <input type="hidden" name="user" value="{{ request.user.id }}">
         <input type="hidden" name="book" value="{{ book.id }}">
+        <input type="hidden" name="privacy" value="public">
         <input type="hidden" name="rating" value="{{ forloop.counter }}">
         <button type="submit" class="icon icon-star-{% if book|rating:user < forloop.counter %}empty{% else %}full{% endif %}">
             <span class="is-sr-only">{{ forloop.counter }} star{{ forloop.counter | pluralize }}</span>

Rate stars don't work
You should be able to click to give a star rating to a book on the book page, it doesn't do anything.
