-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the moderation decision model (#3989)
Co-authored-by: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com> Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu>
- Loading branch information
1 parent
213c886
commit 2bd852c
Showing
7 changed files
with
221 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.db import models | ||
|
||
|
||
class DecisionAction(models.TextChoices): | ||
""" | ||
This enumeration represents the actions that can be taken by a moderator as | ||
a part of a moderation decision. | ||
""" | ||
|
||
MARKED_SENSITIVE = "marked_sensitive", "Marked sensitive" | ||
|
||
DEINDEXED_COPYRIGHT = "deindexed_copyright", "Deindexed (copyright)" | ||
DEINDEXED_SENSITIVE = "deindexed_sensitive", "Deindexed (sensitive)" | ||
|
||
REJECTED_REPORTS = "rejected_reports", "Rejected" | ||
DEDUPLICATED_REPORTS = "deduplicated_reports", "De-duplicated" | ||
|
||
REVERSED_MARK_SENSITIVE = "reversed_mark_sensitive", "Reversed mark sensitive" | ||
REVERSED_DEINDEX = "reversed_deindex", "Reversed deindex" | ||
|
||
@property | ||
def is_reversal(self): | ||
return self in {self.REVERSED_DEINDEX, self.REVERSED_MARK_SENSITIVE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Generated by Django 4.2.7 on 2024-03-31 12:01 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('api', '0057_alter_sensitiveaudio_options'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ImageDecision', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_on', models.DateTimeField(auto_now_add=True)), | ||
('updated_on', models.DateTimeField(auto_now=True)), | ||
('notes', models.TextField(blank=True, help_text="The moderator's explanation for the decision or additional notes.", max_length=500, null=True)), | ||
('action', models.CharField(choices=[('marked_sensitive', 'Marked sensitive'), ('deindexed_copyright', 'Deindexed (copyright)'), ('deindexed_sensitive', 'Deindexed (sensitive)'), ('rejected_reports', 'Rejected'), ('deduplicated_reports', 'De-duplicated'), ('reversed_mark_sensitive', 'Reversed mark sensitive'), ('reversed_deindex', 'Reversed deindex')], help_text='Action taken by the moderator.', max_length=32)), | ||
('media_objs', models.ManyToManyField(db_constraint=False, help_text='The image items being moderated.', to='api.image')), | ||
('moderator', models.ForeignKey(help_text='The moderator who undertook this decision.', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='AudioDecision', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_on', models.DateTimeField(auto_now_add=True)), | ||
('updated_on', models.DateTimeField(auto_now=True)), | ||
('notes', models.TextField(blank=True, help_text="The moderator's explanation for the decision or additional notes.", max_length=500, null=True)), | ||
('action', models.CharField(choices=[('marked_sensitive', 'Marked sensitive'), ('deindexed_copyright', 'Deindexed (copyright)'), ('deindexed_sensitive', 'Deindexed (sensitive)'), ('rejected_reports', 'Rejected'), ('deduplicated_reports', 'De-duplicated'), ('reversed_mark_sensitive', 'Reversed mark sensitive'), ('reversed_deindex', 'Reversed deindex')], help_text='Action taken by the moderator.', max_length=32)), | ||
('media_objs', models.ManyToManyField(db_constraint=False, help_text='The audio items being moderated.', to='api.audio')), | ||
('moderator', models.ForeignKey(help_text='The moderator who undertook this decision.', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.AddField( | ||
model_name='audioreport', | ||
name='decision', | ||
field=models.ForeignKey(blank=True, help_text='The moderation decision for this report.', null=True, on_delete=django.db.models.deletion.SET_NULL, to='api.audiodecision'), | ||
), | ||
migrations.AddField( | ||
model_name='imagereport', | ||
name='decision', | ||
field=models.ForeignKey(blank=True, help_text='The moderation decision for this report.', null=True, on_delete=django.db.models.deletion.SET_NULL, to='api.imagedecision'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.