aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Boris Muratov <[email protected]>2023-03-20 14:07:30 +0200
committerGravatar mbaruh <[email protected]>2023-03-20 14:14:46 +0200
commitd4dda1cfcb3949e7303bef1457ca395da7cd89f6 (patch)
treee07a90e7ffb4840ab3d9e5198ddfa05501591cbe
parentMigrate infraction type `mute` to `timeout` (diff)
parentMerge pull request #902 from python-discord/dependabot/pip/flake8-bugbear-23.... (diff)
Merge branch 'main' into mbaruh/timeout
-rw-r--r--poetry.lock23
-rw-r--r--pydis_site/apps/api/migrations/0086_infraction_jump_url.py18
-rw-r--r--pydis_site/apps/api/migrations/0087_alter_mute_to_timeout.py (renamed from pydis_site/apps/api/migrations/0086_alter_mute_to_timeout.py)2
-rw-r--r--pydis_site/apps/api/models/bot/infraction.py9
-rw-r--r--pydis_site/apps/api/serializers.py3
-rw-r--r--pydis_site/apps/api/viewsets/bot/infraction.py8
-rw-r--r--pyproject.toml6
7 files changed, 50 insertions, 19 deletions
diff --git a/poetry.lock b/poetry.lock
index bf812f1d..6cea8e56 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -449,14 +449,14 @@ requests = "*"
[[package]]
name = "django-environ"
-version = "0.9.0"
+version = "0.10.0"
description = "A package that allows you to utilize 12factor inspired environment variables to configure your Django application."
category = "main"
optional = false
-python-versions = ">=3.4,<4"
+python-versions = ">=3.5,<4"
files = [
- {file = "django-environ-0.9.0.tar.gz", hash = "sha256:bff5381533056328c9ac02f71790bd5bf1cea81b1beeb648f28b81c9e83e0a21"},
- {file = "django_environ-0.9.0-py2.py3-none-any.whl", hash = "sha256:f21a5ef8cc603da1870bbf9a09b7e5577ab5f6da451b843dbcc721a7bca6b3d9"},
+ {file = "django-environ-0.10.0.tar.gz", hash = "sha256:b3559a91439c9d774a9e0c1ced872364772c612cdf6dc919506a2b13f7a77225"},
+ {file = "django_environ-0.10.0-py2.py3-none-any.whl", hash = "sha256:510f8c9c1d0a38b0815f91504270c29440a0cf44fab07f55942fa8d31bbb9be6"},
]
[package.extras]
@@ -596,14 +596,14 @@ flake8 = ">=5.0.0"
[[package]]
name = "flake8-bugbear"
-version = "23.2.13"
+version = "23.3.12"
description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle."
category = "dev"
optional = false
python-versions = ">=3.7"
files = [
- {file = "flake8-bugbear-23.2.13.tar.gz", hash = "sha256:39259814a83f33c8409417ee12dd4050c9c0bb4c8707c12fc18ae62b2f3ddee1"},
- {file = "flake8_bugbear-23.2.13-py3-none-any.whl", hash = "sha256:f136bd0ca2684f101168bba2310dec541e11aa6b252260c17dcf58d18069a740"},
+ {file = "flake8-bugbear-23.3.12.tar.gz", hash = "sha256:e3e7f74c8a49ad3794a7183353026dabd68c74030d5f46571f84c1fb0eb79363"},
+ {file = "flake8_bugbear-23.3.12-py3-none-any.whl", hash = "sha256:beb5c7efcd7ccc2039ef66a77bb8db925e7be3531ff1cb4d0b7030d0e2113d72"},
]
[package.dependencies]
@@ -1168,18 +1168,19 @@ tests = ["coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)"]
[[package]]
name = "pymdown-extensions"
-version = "9.9.2"
+version = "9.10"
description = "Extension pack for Python Markdown."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
- {file = "pymdown_extensions-9.9.2-py3-none-any.whl", hash = "sha256:c3d804eb4a42b85bafb5f36436342a5ad38df03878bb24db8855a4aa8b08b765"},
- {file = "pymdown_extensions-9.9.2.tar.gz", hash = "sha256:ebb33069bafcb64d5f5988043331d4ea4929325dc678a6bcf247ddfcf96499f8"},
+ {file = "pymdown_extensions-9.10-py3-none-any.whl", hash = "sha256:31eaa76ce6f96aabfcea98787c2fff2c5c0611b20a53a94213970cfbf05f02b8"},
+ {file = "pymdown_extensions-9.10.tar.gz", hash = "sha256:562c38eee4ce3f101ce631b804bfc2177a8a76c7e4dc908871fb6741a90257a7"},
]
[package.dependencies]
markdown = ">=3.2"
+pyyaml = "*"
[[package]]
name = "python-dotenv"
@@ -1536,4 +1537,4 @@ brotli = ["Brotli"]
[metadata]
lock-version = "2.0"
python-versions = "3.10.*"
-content-hash = "ee70261808a9356d2d8f728ca09f8ae5ca079520af7d6ab4ef713eb4f8fa7249"
+content-hash = "342f4b67fe2a646a6bee9bb02c741fd1a44e0e1ce3efca0006a21c84b8f0323b"
diff --git a/pydis_site/apps/api/migrations/0086_infraction_jump_url.py b/pydis_site/apps/api/migrations/0086_infraction_jump_url.py
new file mode 100644
index 00000000..7ae65751
--- /dev/null
+++ b/pydis_site/apps/api/migrations/0086_infraction_jump_url.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.1.7 on 2023-03-10 17:25
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0085_add_thread_id_to_nominations'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='infraction',
+ name='jump_url',
+ field=models.URLField(default=None, help_text='The jump url to message invoking the infraction.', max_length=88, null=True),
+ ),
+ ]
diff --git a/pydis_site/apps/api/migrations/0086_alter_mute_to_timeout.py b/pydis_site/apps/api/migrations/0087_alter_mute_to_timeout.py
index 8eb3ff6d..8a826ba5 100644
--- a/pydis_site/apps/api/migrations/0086_alter_mute_to_timeout.py
+++ b/pydis_site/apps/api/migrations/0087_alter_mute_to_timeout.py
@@ -12,7 +12,7 @@ def rename_type(apps: Apps, _) -> None:
class Migration(migrations.Migration):
dependencies = [
- ('api', '0085_add_thread_id_to_nominations'),
+ ('api', '0086_infraction_jump_url'),
]
operations = [
diff --git a/pydis_site/apps/api/models/bot/infraction.py b/pydis_site/apps/api/models/bot/infraction.py
index fcf8651e..381b5b9d 100644
--- a/pydis_site/apps/api/models/bot/infraction.py
+++ b/pydis_site/apps/api/models/bot/infraction.py
@@ -69,6 +69,15 @@ class Infraction(ModelReprMixin, models.Model):
help_text="Whether a DM was sent to the user when infraction was applied."
)
+ jump_url = models.URLField(
+ default=None,
+ null=True,
+ max_length=88,
+ help_text=(
+ "The jump url to message invoking the infraction."
+ )
+ )
+
def __str__(self):
"""Returns some info on the current infraction, for display purposes."""
s = f"#{self.id}: {self.type} on {self.user_id}"
diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py
index 4303e7d0..e74ca102 100644
--- a/pydis_site/apps/api/serializers.py
+++ b/pydis_site/apps/api/serializers.py
@@ -184,7 +184,8 @@ class InfractionSerializer(ModelSerializer):
'type',
'reason',
'hidden',
- 'dm_sent'
+ 'dm_sent',
+ 'jump_url'
)
def validate(self, attrs: dict) -> dict:
diff --git a/pydis_site/apps/api/viewsets/bot/infraction.py b/pydis_site/apps/api/viewsets/bot/infraction.py
index 93d29391..ec8b83a1 100644
--- a/pydis_site/apps/api/viewsets/bot/infraction.py
+++ b/pydis_site/apps/api/viewsets/bot/infraction.py
@@ -72,7 +72,8 @@ class InfractionViewSet(
... 'type': 'ban',
... 'reason': 'He terk my jerb!',
... 'hidden': True,
- ... 'dm_sent': True
+ ... 'dm_sent': True,
+ ... 'jump_url': '<discord message link>'
... }
... ]
@@ -103,7 +104,8 @@ class InfractionViewSet(
... 'type': 'ban',
... 'reason': 'He terk my jerb!',
... 'user': 172395097705414656,
- ... 'dm_sent': False
+ ... 'dm_sent': False,
+ ... 'jump_url': '<discord message link>'
... }
#### Response format
@@ -138,7 +140,7 @@ class InfractionViewSet(
#### Status codes
- 204: returned on success
- - 404: if a infraction with the given `id` does not exist
+ - 404: if an infraction with the given `id` does not exist
### Expanded routes
All routes support expansion of `user` and `actor` in responses. To use an expanded route,
diff --git a/pyproject.toml b/pyproject.toml
index 1fd941e2..d044ba63 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,7 +10,7 @@ python = "3.10.*"
django = "4.1.7"
django-distill = "3.0.2"
-django-environ = "0.9.0"
+django-environ = "0.10.0"
django-filter = "22.1"
django-prometheus = "2.2.0"
django-simple-bulma = "2.5.0"
@@ -20,7 +20,7 @@ httpx = "0.23.3"
markdown = "3.4.1"
psycopg2-binary = "2.9.5"
PyJWT = {version = "2.6.0", extras = ["crypto"]}
-pymdown-extensions = "9.9.2"
+pymdown-extensions = "9.10"
python-frontmatter = "1.0.0"
pyyaml = "6.0"
sentry-sdk = "1.16.0"
@@ -34,7 +34,7 @@ taskipy = "1.10.3"
flake8 = "6.0.0"
flake8-annotations = "3.0.0"
flake8-bandit = "4.1.1"
-flake8-bugbear = "23.2.13"
+flake8-bugbear = "23.3.12"
flake8-docstrings = "1.7.0"
flake8-import-order = "0.18.2"
flake8-tidy-imports = "4.8.0"