Adds action types to report comments table

This commit is contained in:
Mouse Reeve 2023-05-16 09:02:43 -07:00
parent ee1dd612fb
commit ab146f652a
2 changed files with 34 additions and 0 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 3.2.18 on 2023-05-16 16:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0178_auto_20230328_2132'),
]
operations = [
migrations.AddField(
model_name='reportcomment',
name='comment_type',
field=models.CharField(choices=[('comment', 'Comment'), ('resolve', 'Resolved report'), ('reopen', 'Re-opened report'), ('message_reporter', 'Messaged reporter'), ('message_offender', 'Messaged reported user'), ('user_suspension', 'Suspended user'), ('user_deletion', 'Deleted user account'), ('block_domain', 'Blocked domain'), ('approve_domain', 'Approved domain'), ('delete_item', 'Deleted item')], default='comment', max_length=20),
),
]

View file

@ -1,6 +1,7 @@
""" flagged for moderation """
from django.core.exceptions import PermissionDenied
from django.db import models
from django.utils.translation import gettext_lazy as _
from bookwyrm.settings import DOMAIN
from .base_model import BookWyrmModel
@ -38,10 +39,25 @@ class Report(BookWyrmModel):
ordering = ("-created_date",)
ReportCommentTypes = [
("comment", _("Comment")),
("resolve", _("Resolved report")),
("reopen", _("Re-opened report")),
("message_reporter", _("Messaged reporter")),
("message_offender", _("Messaged reported user")),
("user_suspension", _("Suspended user")),
("user_deletion", _("Deleted user account")),
("block_domain", _("Blocked domain")),
("approve_domain", _("Approved domain")),
("delete_item", _("Deleted item")),
]
class ReportComment(BookWyrmModel):
"""updates on a report"""
user = models.ForeignKey("User", on_delete=models.PROTECT)
comment_type = models.CharField(
max_length=20, blank=False, default="comment", choices=ReportCommentTypes
)
note = models.TextField()
report = models.ForeignKey(Report, on_delete=models.PROTECT)