diff options
author | 2019-11-03 20:58:40 +0100 | |
---|---|---|
committer | 2019-11-03 20:58:40 +0100 | |
commit | 982571443adaeb33898f6cbc013ad2b4a7e90ab6 (patch) | |
tree | 9f97d83fd7089ef7551bd6c7c2fecef9d59822d6 /pydis_site/apps/api | |
parent | Make test less fragile and improve test name (diff) | |
parent | Merge pull request #293 from python-discord/update-dependency-pinning (diff) |
Merge branch 'master' into active-infractions-validation
Diffstat (limited to 'pydis_site/apps/api')
-rw-r--r-- | pydis_site/apps/api/migrations/0046_reminder_jump_url.py | 19 | ||||
-rw-r--r-- | pydis_site/apps/api/models/bot/reminder.py | 6 | ||||
-rw-r--r-- | pydis_site/apps/api/serializers.py | 2 | ||||
-rw-r--r-- | pydis_site/apps/api/tests/test_models.py | 4 | ||||
-rw-r--r-- | pydis_site/apps/api/views.py | 50 |
5 files changed, 48 insertions, 33 deletions
diff --git a/pydis_site/apps/api/migrations/0046_reminder_jump_url.py b/pydis_site/apps/api/migrations/0046_reminder_jump_url.py new file mode 100644 index 00000000..b145f0dd --- /dev/null +++ b/pydis_site/apps/api/migrations/0046_reminder_jump_url.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.6 on 2019-10-21 14:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0045_add_plural_name_for_log_entry'), + ] + + operations = [ + migrations.AddField( + model_name='reminder', + name='jump_url', + field=models.URLField(default='', help_text='The jump url to the message that created the reminder', max_length=88), + preserve_default=False, + ), + ] diff --git a/pydis_site/apps/api/models/bot/reminder.py b/pydis_site/apps/api/models/bot/reminder.py index decc9391..d53fedb5 100644 --- a/pydis_site/apps/api/models/bot/reminder.py +++ b/pydis_site/apps/api/models/bot/reminder.py @@ -15,6 +15,12 @@ class Reminder(ModelReprMixin, models.Model): "If not, it has been sent out to the user." ) ) + jump_url = models.URLField( + max_length=88, + help_text=( + "The jump url to the message that created the reminder" + ) + ) author = models.ForeignKey( User, on_delete=models.CASCADE, diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index c3d5f696..4e7cd863 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -201,7 +201,7 @@ class ReminderSerializer(ModelSerializer): """Metadata defined for the Django REST Framework.""" model = Reminder - fields = ('active', 'author', 'channel_id', 'content', 'expiration', 'id') + fields = ('active', 'author', 'jump_url', 'channel_id', 'content', 'expiration', 'id') class RoleSerializer(ModelSerializer): diff --git a/pydis_site/apps/api/tests/test_models.py b/pydis_site/apps/api/tests/test_models.py index bce76942..b4a766d0 100644 --- a/pydis_site/apps/api/tests/test_models.py +++ b/pydis_site/apps/api/tests/test_models.py @@ -115,6 +115,10 @@ class StringDunderMethodTests(SimpleTestCase): discriminator=5, avatar_hash=None ), channel_id=555, + jump_url=( + 'https://discordapp.com/channels/' + '267624335836053506/291284109232308226/463087129459949587' + ), content="oh no", expiration=dt(5018, 11, 20, 15, 52, tzinfo=timezone.utc) ) diff --git a/pydis_site/apps/api/views.py b/pydis_site/apps/api/views.py index 32583665..f0f7efa9 100644 --- a/pydis_site/apps/api/views.py +++ b/pydis_site/apps/api/views.py @@ -103,60 +103,46 @@ class RulesView(APIView): f"`format` must be `html` or `md`, got `{format}`." ) - discord_community_guidelines_link = self._format_link( + discord_community_guidelines = self._format_link( 'Discord Community Guidelines', 'https://discordapp.com/guidelines', link_format ) - channels_page_link = self._format_link( - 'channels page', - 'https://pythondiscord.com/about/channels', + discord_tos = self._format_link( + 'Terms Of Service', + 'https://discordapp.com/guidelines', link_format ) - google_translate_link = self._format_link( - 'Google Translate', - 'https://translate.google.com/', + pydis_coc = self._format_link( + 'Python Discord Code of Conduct', + 'https://pythondiscord.com/pages/code-of-conduct/', link_format ) return Response([ - "Be polite, and do not spam.", - f"Follow the {discord_community_guidelines_link}.", ( - "Don't intentionally make other people uncomfortable - if " - "someone asks you to stop discussing something, you should stop." + f"Follow the {discord_community_guidelines} and {discord_tos}." ), ( - "Be patient both with users asking " - "questions, and the users answering them." + f"Follow the {pydis_coc}." ), ( - "We will not help you with anything that might break a law or the " - "terms of service of any other community, site, service, or " - "otherwise - No piracy, brute-forcing, captcha circumvention, " - "sneaker bots, or anything else of that nature." + "Listen to and respect staff members and their instructions." ), ( - "Listen to and respect the staff members - we're " - "here to help, but we're all human beings." + "This is an English-speaking server, " + "so please speak English to the best of your ability." ), ( - "All discussion should be kept within the relevant " - "channels for the subject - See the " - f"{channels_page_link} for more information." + "Do not provide or request help on projects that may break laws, " + "breach terms of services, be considered malicious/inappropriate " + "or be for graded coursework/exams." ), ( - "This is an English-speaking server, so please speak English " - f"to the best of your ability - {google_translate_link} " - "should be fine if you're not sure." + "No spamming or unapproved advertising, including requests for paid work. " + "Open-source projects can be showcased in #show-your-projects." ), ( - "Keep all discussions safe for work - No gore, nudity, sexual " - "soliciting, references to suicide, or anything else of that nature" + "Keep discussions relevant to channel topics and guidelines." ), - ( - "We do not allow advertisements for communities (including " - "other Discord servers) or commercial projects - Contact " - "us directly if you want to discuss a partnership!" - ) ]) |