Skip to content
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

Implement following system, bio, ~notifications~, profanity checking and generic UI updates #322

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
123f8f9
follower models
Bentheminernz Sep 25, 2024
e1c40be
Following view
Bentheminernz Sep 25, 2024
b5d1022
Show who you follow
Bentheminernz Sep 25, 2024
66b069b
Followers list, UI follow and unfollow buttons
Bentheminernz Sep 25, 2024
61060f4
Fixes following text
Bentheminernz Sep 25, 2024
40411fd
Fixes update stages and debug storage
Bentheminernz Sep 26, 2024
81f019d
Changes how following system is loaded
Bentheminernz Sep 26, 2024
ab80d2d
Cover in admin, changes to sidebar and following list
Bentheminernz Sep 26, 2024
0347a51
Changes email_backend to terminal when in debug
Bentheminernz Sep 26, 2024
844f43b
Update models.py
Bentheminernz Sep 26, 2024
d1460e8
New follow button
Bentheminernz Sep 26, 2024
039d6b6
bio
Bentheminernz Sep 26, 2024
1c5ff7c
Adds follow button to follow views
Bentheminernz Sep 26, 2024
7bad22c
Makes page reload on follow/unfollow instead of redirect
Bentheminernz Sep 26, 2024
b408751
Refactors group and removes unneeded text from battle view
Bentheminernz Sep 26, 2024
40002e1
Fixes following/unfollow button logic in follow view
Bentheminernz Sep 27, 2024
bda900b
Move link icon
Bentheminernz Sep 27, 2024
9b25736
Update All, upload battle README
Bentheminernz Sep 27, 2024
dbf761d
More tweaks to sizing and spacing
Bentheminernz Sep 28, 2024
21eee3e
Update settings.html
Bentheminernz Sep 28, 2024
6f9d132
Notifications
Bentheminernz Sep 29, 2024
ab9393e
Fixes notification popup and removes unneeded view
Bentheminernz Sep 29, 2024
ef619c2
Notification Menu refresh on opening. Fixes errors when logged out
Bentheminernz Sep 29, 2024
377ed3e
More tweaks to notification loading
Bentheminernz Sep 30, 2024
0be3d86
Notifications won't fetch if window isn't active
Bentheminernz Sep 30, 2024
bb24e6e
Check for profanity in user text fields
Bentheminernz Sep 30, 2024
ac17661
check for profanity in groups
Bentheminernz Sep 30, 2024
2df842f
Update pyproject and poetry
Bentheminernz Sep 30, 2024
55ac0d8
Removes useless if username as per PR#317
Bentheminernz Sep 30, 2024
73cee36
Tweaks to button spacing and sizing
Bentheminernz Oct 1, 2024
a330b85
Adds web app support to Splashcat, fixes pages not loading if logged out
Bentheminernz Oct 1, 2024
3a535c3
Tweaks to notification alert
Bentheminernz Oct 1, 2024
ab2efdd
working on timezone stuff
Bentheminernz Oct 2, 2024
c726497
add pytz dependency
catgirlinspace Oct 6, 2024
4880ca6
finally fixes user-link -_-
Bentheminernz Oct 6, 2024
89a6372
Merge branch 'following-system' of https://github.com/Bentheminernz/s…
Bentheminernz Oct 6, 2024
da8c81a
Disables notification center, moves name in battle list
Bentheminernz Oct 20, 2024
77aa4d0
Merge branch 'main' into following-system
Bentheminernz Oct 20, 2024
403bd03
Update poetry.lock
Bentheminernz Oct 20, 2024
a72bbfb
Merge branch 'following-system' of https://github.com/Bentheminernz/s…
Bentheminernz Oct 20, 2024
9241c14
Update poetry.lock
Bentheminernz Oct 20, 2024
f897c14
Merge branch 'main' into following-system
Bentheminernz Oct 20, 2024
9b6458b
Update content-hash in poetry.lock
Bentheminernz Oct 20, 2024
44711de
Add group deletion functionality
Bentheminernz Nov 5, 2024
1facdb1
Verbage update
Bentheminernz Nov 5, 2024
cd1ad51
Adds default to timezone
Bentheminernz Nov 6, 2024
94f6ee4
Merge branch 'main' into following-system
Bentheminernz Nov 14, 2024
823ca7b
Poetry Lock
Bentheminernz Nov 14, 2024
95c9c94
stupid rookie HTTP address error
Bentheminernz Nov 14, 2024
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ please [report it! ](https://github.com/splashcat-ink/splashcat/issues/new "repo
If it's a security vulnerability please contact [email protected] or use GitHub's tools for reporting
security issues. Do **not** use a public GitHub issue.

## Upload battles to local instance of Splashcat
To upload battle data to a local debug instance of splashcat follow [this guide](https://github.com/splashcat-ink/splashcat/blob/main/UPLOADING-BATTLES.md)

## Donating

Sponsoring me will support Splashcat and its server costs. Getting the $5+ monthly tier also gives you some little
Expand Down
36 changes: 36 additions & 0 deletions UPLOADING-BATTLES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## How to upload battles (For Development)
This guide is for uploading battles to Splashcat in a local debug instance. The guide for uploading it to the production website is [here](https://splashcat.ink/uploaders-information/)

Ensure that you are running Splashcat in **debug** mode and at address `http://127.0.0.1:8000`
1. Enter poetry shell
```bash
cd *splashcat directory*
poetry shell
```
2. Download the required SplatNet 3 assets (Note: This might take a long time if you have a slow internet connection and it is important you do it in the order below)
```bash
python manage.py updateall
```
3. Install [Deno](https://deno.land/) (if it isn't installed)

4. Upload battles to Splashcat
```bash
python manage.py runserver
deno run -Ar https://raw.githubusercontent.com/bentheminernz/s3si.ts-local-splashcat/main/s3si.ts -e splashcat
```

5. Follow the instuctions to setup s3si.ts and afterwards your battles should just upload to Splashcat!

### Manually Update SplatNet 3 assets
Use this if updateall isn't working or you want to update individual asset types.
```bash
./manage.py updatelocalizationstrings
./manage.py updategear
./manage.py updatesplashtags
./manage.py updatestages
./manage.py updateweapons
./manage.py updatetitles
./manage.py updateawards
./manage.py updatechallenges
./manage.py updatesplatfests
```
6 changes: 3 additions & 3 deletions battles/templates/battles/global_data_export.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}

{% block content %}
<h1 class="text-3xl font-splatoon1">
<h1 class="text-3xl font-splatoon1 ">
{% block title %}
Global Data Exports
{% endblock %}
Expand All @@ -12,7 +12,7 @@ <h1 class="text-3xl font-splatoon1">

{% if user.is_verified_for_export_download %}
<a href="{% url 'battles:redirect_global_data_export' %}"
class="p-4 rounded bg-pink-600 hover:bg-pink-700 block w-fit">Download</a>
class="px-4 py-2 my-3 rounded bg-pink-600 hover:bg-pink-700 block w-fit">Download</a>
{% else %}
<div>
Your account does not meet the requirements to download the data. Splashcat has some basic requirements for
Expand Down Expand Up @@ -191,7 +191,7 @@ <h3 class="text-lg">
</tbody>
</table>

<h3 class="text-lg">
<h3 class="text-lg mt-4">
Players
</h3>

Expand Down
20 changes: 0 additions & 20 deletions battles/templates/battles/view_battle.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,26 +172,6 @@ <h1 class="text-3xl font-splatoon1">
{% endfor %}
</div>

<div class="row-start-1 row-end-2 lg:col-start-1 lg:col-end-4 lg:row-start-4 lg:row-end-5 px-4 text-center text-gray-50 flex flex-col gap-2 justify-end [text-shadow:1px_1px_black]">
<span>
<span>{{ battle.played_time }}</span>
<span>{{ battle.duration|duration }}</span>
</span>

<span>
<span>{{ battle.player.paint }}p</span>
{% if battle.power %}
Power: {{ battle.power|format_power }}
{% endif %}
{% if battle.splatfest_clout_contribution %}
<span>Clout: {{ battle.splatfest_clout_contribution }}</span>
{% endif %}
{% if battle.splatfest_festival_shells %}
<span>Festival Shells: {{ battle.splatfest_festival_shells }}</span>
{% endif %}
</span>
</div>

<div class="row-start-2 row-end-3 lg:col-start-1 lg:col-end-4 lg:row-start-5 lg:row-end-6 bg-gray-800/50 relative bg-[url('../images/tapes-transparent.png')] bg-contain rounded-lg px-4 py-2 mx-4 mb-4 flex flex-col gap-2">
<div class="flex gap-4">
<span class="text-xl md:text-3xl font-splatoon1">
Expand Down
24 changes: 24 additions & 0 deletions groups/migrations/0006_alter_group_description_alter_group_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.1.1 on 2024-09-30 00:36

import groups.models
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('groups', '0005_alter_group_pending_invites_and_more'),
]

operations = [
migrations.AlterField(
model_name='group',
name='description',
field=models.TextField(blank=True, default='', validators=[groups.models.validate_no_profanity]),
),
migrations.AlterField(
model_name='group',
name='name',
field=models.CharField(max_length=255, validators=[groups.models.validate_no_profanity]),
),
]
10 changes: 8 additions & 2 deletions groups/models.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
from django.db import models
from django.urls import reverse

from better_profanity import profanity
from django.core.exceptions import ValidationError

# Create your models here.

def validate_no_profanity(value):
if profanity.contains_profanity(value):
raise ValidationError(("This text contains inappropriate language."))

class Group(models.Model):
class PrivacyLevels(models.TextChoices):
PUBLIC = 'PUBLIC', 'Public'
RESTRICTED = 'RESTRICTED', 'Restricted'
PRIVATE = 'PRIVATE', 'Private'

name = models.CharField(max_length=255)
description = models.TextField(blank=True, default='')
name = models.CharField(max_length=255, validators=[validate_no_profanity])
description = models.TextField(blank=True, default='', validators=[validate_no_profanity])
members = models.ManyToManyField('users.User', through='Membership')
owner = models.ForeignKey('users.User', related_name='groups_owned', on_delete=models.CASCADE)
pending_invites = models.ManyToManyField('users.User', related_name='pending_group_invites', blank=True)
Expand Down
10 changes: 10 additions & 0 deletions groups/templates/groups/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ <h1 class="text-3xl font-splatoon1 mb-2">
</div>

<div class="form-div-cards">
<div>
<h1 class="text-xl font-splatoon1 mt-1">Delete Group</h1>
<p class="mb-4">Note: All members will be kicked, this is <b>irreversible!</b></p>
<a hx-post="{% url 'groups:delete_group' group.id %}"
hx-confirm="Are you sure you want to delete this group?"
class="bg-red-700 py-2 px-4 rounded w-fit cursor-pointer">
Delete Group
</a>
</div>

{% if group.privacy_level == group.PrivacyLevels.RESTRICTED %}
<div>
<h1 class="text-xl font-splatoon1">Pending Join Requests</h1>
Expand Down
2 changes: 1 addition & 1 deletion groups/templates/groups/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 class="font-splatoon1 text-3xl pb-2">
{% endif %}
{% if is_group_member and group.owner != user %}
<a hx-post="{% url 'groups:leave_group' group.id %}"
hx-confirm="Are you sure you want to leave {{ group.name }}?" class="bg-purple-700 p-2 rounded w-fit">
hx-confirm="Are you sure you want to leave {{ group.name }}?" class="bg-purple-700 p-2 rounded w-fit cursor-pointer">
Leave Group
</a>
{% endif %}
Expand Down
3 changes: 2 additions & 1 deletion groups/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from django.urls import path

from groups.views import view_group, groups_index, group_admin, answer_join_request, invite_to_group, \
answer_group_invite, request_join_group, join_group, leave_group, create_group
answer_group_invite, request_join_group, join_group, leave_group, create_group, delete_group

app_name = "groups"
urlpatterns = [
path("", groups_index, name="index"),
path("<int:group_id>/", view_group, name="view_group"),
path("<int:group_id>/admin/", group_admin, name="group_admin"),
path("<int:group_id>/admin/delete/", delete_group, name="delete_group"),
path("create/", create_group, name="create_group"),
path("<int:group_id>/request/", request_join_group, name="request_join_group"),
path("<int:group_id>/request/answer/", answer_join_request, name="answer_join_request"),
Expand Down
9 changes: 9 additions & 0 deletions groups/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,12 @@ def leave_group(request, group_id):
group.members.remove(request.user)
messages.success(request, f'Left {group.name}.')
return HttpResponseClientRedirect(reverse('groups:index'))

@require_POST
def delete_group(request, group_id):
group = get_object_or_404(Group, pk=group_id)
if group.owner != request.user:
return HttpResponseForbidden()
group.delete()
messages.success(request, 'Group deleted.')
return HttpResponseClientRedirect(reverse('groups:index'))
Loading
Loading