Make it possible to fully delete unlisted/unrated extensions #81
18
abuse/migrations/0005_alter_abusereport_type.py
Normal file
18
abuse/migrations/0005_alter_abusereport_type.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2.11 on 2024-04-18 13:48
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('abuse', '0004_abusereport_rating_abusereport_type'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='abusereport',
|
||||||
|
name='type',
|
||||||
|
field=models.PositiveSmallIntegerField(choices=[(1, 'Extension'), (2, 'User'), (3, 'Rating')], default=1),
|
||||||
|
),
|
||||||
|
]
|
@ -8,7 +8,7 @@ from django.urls import reverse
|
|||||||
from extended_choices import Choices
|
from extended_choices import Choices
|
||||||
from geoip2.errors import GeoIP2Error
|
from geoip2.errors import GeoIP2Error
|
||||||
|
|
||||||
from constants.base import ABUSE_TYPE, ABUSE_TYPE_EXTENSION, ABUSE_TYPE_REVIEW
|
from constants.base import ABUSE_TYPE, ABUSE_TYPE_EXTENSION, ABUSE_TYPE_RATING
|
||||||
from common.model_mixins import CreatedModifiedMixin, TrackChangesMixin
|
from common.model_mixins import CreatedModifiedMixin, TrackChangesMixin
|
||||||
import extensions.fields
|
import extensions.fields
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class AbuseReport(CreatedModifiedMixin, TrackChangesMixin, models.Model):
|
|||||||
reporter_id=user_id,
|
reporter_id=user_id,
|
||||||
extension_id=extension_id,
|
extension_id=extension_id,
|
||||||
rating_id=rating_id,
|
rating_id=rating_id,
|
||||||
type=ABUSE_TYPE_REVIEW,
|
type=ABUSE_TYPE_RATING,
|
||||||
).exists()
|
).exists()
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
@ -8,7 +8,7 @@ from django.views.generic.edit import CreateView
|
|||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
|
|
||||||
from .forms import ReportForm
|
from .forms import ReportForm
|
||||||
from constants.base import ABUSE_TYPE_EXTENSION, ABUSE_TYPE_REVIEW
|
from constants.base import ABUSE_TYPE_EXTENSION, ABUSE_TYPE_RATING
|
||||||
from abuse.models import AbuseReport
|
from abuse.models import AbuseReport
|
||||||
from ratings.models import Rating
|
from ratings.models import Rating
|
||||||
from extensions.models import Extension, Version
|
from extensions.models import Extension, Version
|
||||||
@ -109,7 +109,7 @@ class ReportReviewView(
|
|||||||
form.instance.extension = self.extension
|
form.instance.extension = self.extension
|
||||||
form.instance.rating = self.rating
|
form.instance.rating = self.rating
|
||||||
form.instance.extension_version = self.version.version
|
form.instance.extension_version = self.version.version
|
||||||
form.instance.type = ABUSE_TYPE_REVIEW
|
form.instance.type = ABUSE_TYPE_RATING
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
@ -93,10 +93,10 @@ TEAM_ROLE_CHOICES = (
|
|||||||
# Abuse
|
# Abuse
|
||||||
ABUSE_TYPE_EXTENSION = 1
|
ABUSE_TYPE_EXTENSION = 1
|
||||||
ABUSE_TYPE_USER = 2
|
ABUSE_TYPE_USER = 2
|
||||||
ABUSE_TYPE_REVIEW = 3
|
ABUSE_TYPE_RATING = 3
|
||||||
|
|
||||||
ABUSE_TYPE = Choices(
|
ABUSE_TYPE = Choices(
|
||||||
('ABUSE_EXTENSION', ABUSE_TYPE_EXTENSION, "Extension"),
|
('ABUSE_EXTENSION', ABUSE_TYPE_EXTENSION, "Extension"),
|
||||||
('ABUSE_USER', ABUSE_TYPE_USER, "User"),
|
('ABUSE_USER', ABUSE_TYPE_USER, "User"),
|
||||||
('ABUSE_REVIEW', ABUSE_TYPE_REVIEW, "Review"),
|
('ABUSE_RATING', ABUSE_TYPE_RATING, "Rating"),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user