Make it possible to fully delete unlisted/unrated extensions #81

Merged
Anna Sirota merged 24 commits from fully-delete-extension into main 2024-04-19 11:00:19 +02:00
4 changed files with 24 additions and 6 deletions
Showing only changes of commit 70354e8ec2 - Show all commits

View 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),
),
]

View File

@ -8,7 +8,7 @@ from django.urls import reverse
from extended_choices import Choices
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
import extensions.fields
@ -100,7 +100,7 @@ class AbuseReport(CreatedModifiedMixin, TrackChangesMixin, models.Model):
reporter_id=user_id,
extension_id=extension_id,
rating_id=rating_id,
type=ABUSE_TYPE_REVIEW,
type=ABUSE_TYPE_RATING,
).exists()
def get_absolute_url(self):

View File

@ -8,7 +8,7 @@ from django.views.generic.edit import CreateView
from django.shortcuts import get_object_or_404, redirect
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 ratings.models import Rating
from extensions.models import Extension, Version
@ -109,7 +109,7 @@ class ReportReviewView(
form.instance.extension = self.extension
form.instance.rating = self.rating
form.instance.extension_version = self.version.version
form.instance.type = ABUSE_TYPE_REVIEW
form.instance.type = ABUSE_TYPE_RATING
return super().form_valid(form)
def get_context_data(self, **kwargs):

View File

@ -93,10 +93,10 @@ TEAM_ROLE_CHOICES = (
# Abuse
ABUSE_TYPE_EXTENSION = 1
ABUSE_TYPE_USER = 2
ABUSE_TYPE_REVIEW = 3
ABUSE_TYPE_RATING = 3
ABUSE_TYPE = Choices(
('ABUSE_EXTENSION', ABUSE_TYPE_EXTENSION, "Extension"),
('ABUSE_USER', ABUSE_TYPE_USER, "User"),
('ABUSE_REVIEW', ABUSE_TYPE_REVIEW, "Review"),
('ABUSE_RATING', ABUSE_TYPE_RATING, "Rating"),
)