2021-03-09 01:16:59 +00:00
|
|
|
""" flagged for moderation """
|
|
|
|
from django.db import models
|
2022-01-30 16:50:53 +00:00
|
|
|
from bookwyrm.settings import DOMAIN
|
2021-03-09 01:16:59 +00:00
|
|
|
from .base_model import BookWyrmModel
|
|
|
|
|
|
|
|
|
|
|
|
class Report(BookWyrmModel):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""reported status or user"""
|
2021-03-09 01:16:59 +00:00
|
|
|
|
|
|
|
reporter = models.ForeignKey(
|
|
|
|
"User", related_name="reporter", on_delete=models.PROTECT
|
|
|
|
)
|
|
|
|
note = models.TextField(null=True, blank=True)
|
|
|
|
user = models.ForeignKey("User", on_delete=models.PROTECT)
|
2021-03-13 00:31:46 +00:00
|
|
|
statuses = models.ManyToManyField("Status", blank=True)
|
2022-01-10 22:55:10 +00:00
|
|
|
links = models.ManyToManyField("Link", blank=True)
|
2021-03-09 01:16:59 +00:00
|
|
|
resolved = models.BooleanField(default=False)
|
|
|
|
|
2022-01-30 16:50:53 +00:00
|
|
|
def get_remote_id(self):
|
|
|
|
return f"https://{DOMAIN}/settings/reports/{self.id}"
|
|
|
|
|
2021-03-09 02:36:34 +00:00
|
|
|
class Meta:
|
2022-01-10 22:55:10 +00:00
|
|
|
"""set order by default"""
|
2021-03-09 20:57:38 +00:00
|
|
|
|
2021-03-12 01:38:21 +00:00
|
|
|
ordering = ("-created_date",)
|
2021-03-09 01:16:59 +00:00
|
|
|
|
2021-03-09 20:57:38 +00:00
|
|
|
|
2021-03-09 01:16:59 +00:00
|
|
|
class ReportComment(BookWyrmModel):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""updates on a report"""
|
2021-03-09 01:16:59 +00:00
|
|
|
|
|
|
|
user = models.ForeignKey("User", on_delete=models.PROTECT)
|
|
|
|
note = models.TextField()
|
|
|
|
report = models.ForeignKey(Report, on_delete=models.PROTECT)
|
2021-03-12 23:56:54 +00:00
|
|
|
|
|
|
|
class Meta:
|
2021-04-26 16:15:42 +00:00
|
|
|
"""sort comments"""
|
2021-03-12 23:56:54 +00:00
|
|
|
|
|
|
|
ordering = ("-created_date",)
|