Skip to content

Spam: allow to mark a project as (non)spam manually #8779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readthedocs/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class ProjectAdmin(ExtraSimpleHistoryAdmin):

list_filter = list_filter + (
ProjectOwnerBannedFilter,
'is_spam',
'feature__feature_id',
'repo_type',
'privacy_level',
Expand Down
23 changes: 23 additions & 0 deletions readthedocs/projects/migrations/0086_is_spam.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.25 on 2021-12-21 09:35

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('projects', '0085_subscribe_old_webhooks_to_events'),
]

operations = [
migrations.AddField(
model_name='historicalproject',
name='is_spam',
field=models.NullBooleanField(default=None, help_text='Manually marked as (not) spam', verbose_name='Is spam?'),
),
migrations.AddField(
model_name='project',
name='is_spam',
field=models.NullBooleanField(default=None, help_text='Manually marked as (not) spam', verbose_name='Is spam?'),
),
]
5 changes: 5 additions & 0 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ class Project(models.Model):
default=False,
help_text='If checked, do not show advertising for this project',
)
is_spam = models.NullBooleanField(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In https://github.com/readthedocs/readthedocs.org/pull/8717/files#diff-2026582e018afc479271c2c856ebf5163912b778923ab381526f03d3aa2363a3 you are replacing NullBoolean fields with a boolean field that accepts null values, probably better to use a boolean field here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this seems useful 👍

_('Is spam?'),
default=None,
help_text=_('Manually marked as (not) spam'),
)
show_version_warning = models.BooleanField(
_('Show version warning'),
default=False,
Expand Down
1 change: 1 addition & 0 deletions readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,3 +894,4 @@ def DOCKER_LIMITS(self):
RTD_SPAM_THRESHOLD_DONT_SHOW_DASHBOARD = 300
RTD_SPAM_THRESHOLD_DONT_SERVE_DOCS = 500
RTD_SPAM_THRESHOLD_DELETE_PROJECT = 1000
RTD_SPAM_MAX_SCORE = 9999