Skip to content

Commit cc59fc7

Browse files
authored
Merge branch 'main' into move-config-docs-to-contributing-guide
2 parents ef59812 + 3a4a78e commit cc59fc7

30 files changed

+507
-41
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Resource Suggestion
3+
about: Suggest a resource for the Python Discord resource index.
4+
title: 'Resource Suggestion: '
5+
labels: 'resource suggestion'
6+
assignees: 'swfarnsworth'
7+
---
8+
9+
**Resource name**
10+
11+
**Resource location**\
12+
Should be a link of some kind, either to the resource itself or (in the case of resources that must be purchased) an information page about it.
13+
14+
**Payment type**\
15+
Options are free, paid, and subscription. Combinations of these are allowed for special cases (like a limited free version).
16+
17+
**Why it should be included**\
18+
A brief explanation for why you think this resource is valuable.
19+
20+
**Potential limitations**\
21+
Is the resource easy to use? Does it contain good information but have poorly-written code? Is it outdated in some way? If so, explain why it should still be included.

.github/workflows/deploy.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ jobs:
4444
site/deployment.yaml
4545
images: 'ghcr.io/python-discord/site:${{ steps.sha_tag.outputs.tag }}'
4646
kubectl-version: 'latest'
47+
48+
- name: Purge Cloudflare Edge Cache
49+
uses: jakejarvis/cloudflare-purge-action@master
50+
env:
51+
CLOUDFLARE_ZONE: 989c984a358bfcd1e9b9d188cc86c1df
52+
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 3.0.14 on 2021-06-18 21:14
2+
3+
import django.core.validators
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('api', '0069_documentationlink_validators'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='role',
16+
name='permissions',
17+
field=models.BigIntegerField(help_text='The integer value of the permission bitset of this role from Discord.', validators=[django.core.validators.MinValueValidator(limit_value=0, message='Role permissions cannot be negative.')]),
18+
),
19+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.0.14 on 2021-06-24 14:45
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('api', '0070_auto_20210618_2114'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='deletedmessage',
15+
name='content',
16+
field=models.CharField(blank=True, help_text='The content of this message, taken from Discord.', max_length=4000),
17+
),
18+
]

pydis_site/apps/api/models/bot/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Message(ModelReprMixin, models.Model):
4343
verbose_name="Channel ID"
4444
)
4545
content = models.CharField(
46-
max_length=2_000,
46+
max_length=4_000,
4747
help_text="The content of this message, taken from Discord.",
4848
blank=True
4949
)

pydis_site/apps/api/models/bot/role.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from django.core.validators import MaxValueValidator, MinValueValidator
3+
from django.core.validators import MinValueValidator
44
from django.db import models
55

66
from pydis_site.apps.api.models.mixins import ModelReprMixin
@@ -38,16 +38,12 @@ class Role(ModelReprMixin, models.Model):
3838
),
3939
help_text="The integer value of the colour of this role from Discord."
4040
)
41-
permissions = models.IntegerField(
41+
permissions = models.BigIntegerField(
4242
validators=(
4343
MinValueValidator(
4444
limit_value=0,
4545
message="Role permissions cannot be negative."
4646
),
47-
MaxValueValidator(
48-
limit_value=2 << 32,
49-
message="Role permission bitset exceeds value of having all permissions"
50-
)
5147
),
5248
help_text="The integer value of the permission bitset of this role from Discord."
5349
)

pydis_site/apps/api/tests/test_models.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime as dt
22

3-
from django.test import SimpleTestCase
3+
from django.core.exceptions import ValidationError
4+
from django.test import SimpleTestCase, TestCase
45
from django.utils import timezone
56

67
from pydis_site.apps.api.models import (
@@ -34,6 +35,43 @@ def test_shows_attributes(self):
3435
self.assertEqual(repr(self.klass), expected)
3536

3637

38+
class NitroMessageLengthTest(TestCase):
39+
def setUp(self):
40+
self.user = User.objects.create(id=50, name='bill', discriminator=5)
41+
self.context = MessageDeletionContext.objects.create(
42+
id=50,
43+
actor=self.user,
44+
creation=dt.utcnow()
45+
)
46+
47+
def test_create(self):
48+
message = DeletedMessage(
49+
id=46,
50+
author=self.user,
51+
channel_id=666,
52+
content="w"*4000,
53+
deletion_context=self.context,
54+
embeds=[]
55+
)
56+
57+
try:
58+
message.clean_fields()
59+
except Exception as e: # pragma: no cover
60+
self.fail(f"Creation of message of length 3950 failed with: {e}")
61+
62+
def test_create_failure(self):
63+
message = DeletedMessage(
64+
id=47,
65+
author=self.user,
66+
channel_id=666,
67+
content="w"*4001,
68+
deletion_context=self.context,
69+
embeds=[]
70+
)
71+
72+
self.assertRaisesRegex(ValidationError, "content':", message.clean_fields)
73+
74+
3775
class StringDunderMethodTests(SimpleTestCase):
3876
def setUp(self):
3977
self.nomination = Nomination(

pydis_site/apps/resources/resources/communities/rlbot.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

pydis_site/static/css/error_pages.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ li {
4848
display: flex;
4949
flex-direction: column;
5050
max-width: 512px;
51-
background-color: white;
5251
border-radius: 20px;
5352
overflow: hidden;
5453
box-shadow: 5px 7px 40px rgba(0, 0, 0, 0.432);
@@ -64,4 +63,5 @@ li {
6463

6564
.content-box {
6665
padding: 25px;
66+
background: #fff;
6767
}
6.99 KB
Loading

0 commit comments

Comments
 (0)