uwuify (joke)
This commit is contained in:
parent
27ff7f1bfd
commit
34ac7ae8ed
@ -135,7 +135,7 @@ class SubscriptionSerializer(DynamicModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Subscription
|
||||
fields = ("id", "name", "url", "guild_id", "channels_count", "creation_datetime", "extra_notes", "filters", "active")
|
||||
fields = ("id", "name", "url", "guild_id", "channels_count", "creation_datetime", "extra_notes", "uwuify", "filters", "active")
|
||||
|
||||
|
||||
class SavedGuildSerializer(DynamicModelSerializer):
|
||||
|
18
apps/home/migrations/0004_subscription_uwuify.py
Normal file
18
apps/home/migrations/0004_subscription_uwuify.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.4 on 2024-06-15 21:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0003_filter_whitelist'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='subscription',
|
||||
name='uwuify',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
18
apps/home/migrations/0005_alter_trackedcontent_url.py
Normal file
18
apps/home/migrations/0005_alter_trackedcontent_url.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.4 on 2024-06-15 22:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('home', '0004_subscription_uwuify'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='trackedcontent',
|
||||
name='url',
|
||||
field=models.URLField(unique=True),
|
||||
),
|
||||
]
|
@ -202,6 +202,8 @@ class Subscription(models.Model):
|
||||
blank=True,
|
||||
)
|
||||
|
||||
uwuify = models.BooleanField(default=False)
|
||||
|
||||
filters = models.ManyToManyField(to="home.Filter", blank=True)
|
||||
|
||||
active = models.BooleanField(default=True)
|
||||
@ -251,7 +253,7 @@ class TrackedContent(models.Model):
|
||||
|
||||
title = models.CharField(max_length=128)
|
||||
|
||||
url = models.URLField()
|
||||
url = models.URLField(unique=True)
|
||||
|
||||
subscription = models.ForeignKey(to=Subscription, on_delete=models.CASCADE)
|
||||
|
||||
|
@ -149,6 +149,7 @@ async function showEditSubModal(subId) {
|
||||
$("#subFormModal .form-edit").hide();
|
||||
$("#subChannels").val("").change();
|
||||
$("#subFilters").val("").change();
|
||||
$("#subUwu").prop("checked", false);
|
||||
$("#subActive").prop("checked", true);
|
||||
$("#subImagePreview img").attr("src", "").hide();
|
||||
$("#subImagePreview small").show();
|
||||
@ -161,6 +162,7 @@ async function showEditSubModal(subId) {
|
||||
$("#subName").val(subscription.name);
|
||||
$("#subUrl").val(subscription.url);
|
||||
$("#subExtraNotes").val(subscription.extra_notes);
|
||||
$("#subUwu").prop("checked", subscription.uwuify);
|
||||
$("#subActive").prop("checked", subscription.active);
|
||||
$("#subFormModal .form-create").hide();
|
||||
$("#subFormModal .form-edit").show();
|
||||
@ -185,13 +187,14 @@ $("#subForm").on("submit", async function(event) {
|
||||
url = $("#subUrl").val();
|
||||
guildId = getCurrentlyActiveServer().guild_id;
|
||||
extraNotes = $("#subExtraNotes").val();
|
||||
uwuify = $("#subUwu").prop("checked");
|
||||
subChannels = $("#subChannels option:selected").toArray().map(channel => channel.value);
|
||||
subFilters = $("#subFilters option:selected").toArray().map(filter => parseInt(filter.value));
|
||||
active = $("#subActive").prop("checked");
|
||||
|
||||
// alert(JSON.stringify(subFilters, null, 4));
|
||||
|
||||
var subPrimaryKey = await saveSubscription(id, name, url, guildId, extraNotes, subFilters, active);
|
||||
var subPrimaryKey = await saveSubscription(id, name, url, guildId, extraNotes, uwuify, subFilters, active);
|
||||
|
||||
await deleteSubChannels(subPrimaryKey);
|
||||
subChannels.forEach(async channelId => {
|
||||
@ -205,12 +208,13 @@ $("#subForm").on("submit", async function(event) {
|
||||
$("#subFormModal").modal("hide");
|
||||
});
|
||||
|
||||
async function saveSubscription(id, name, url, guildId, extraNotes, filters, active, handleErrorMsg=true) {
|
||||
async function saveSubscription(id, name, url, guildId, extraNotes, uwuify, filters, active, handleErrorMsg=true) {
|
||||
var formData = new FormData();
|
||||
formData.append("name", name);
|
||||
formData.append("url", url);
|
||||
formData.append("guild_id", guildId);
|
||||
formData.append("extra_notes", extraNotes);
|
||||
formData.append("uwuify", uwuify)
|
||||
filters.forEach(filter => formData.append("filters", filter));
|
||||
formData.append("active", active);
|
||||
|
||||
|
@ -39,13 +39,20 @@
|
||||
<select name="subFilters" id="subFilters" class="select-2" multiple data-dropdownparent="#subFormModal" tabindex="4"></select>
|
||||
<div class="form-text">Filters to apply to this subscription's content.</div>
|
||||
</div>
|
||||
<div class="form-switch ps-0">
|
||||
<div class="form-switch mb-4 ps-0">
|
||||
<label for="subActive" class="form-check-label mb-2">Active</label>
|
||||
<br>
|
||||
<input type="checkbox" id="subActive" name="subActive" class="form-check-input ms-0 mt-0" tabindex="6">
|
||||
<br>
|
||||
<div class="form-text">Inactive subscriptions wont be processed.</div>
|
||||
</div>
|
||||
<div class="form-switch ps-0">
|
||||
<label for="subUwu" class="form-check-label mb-2">Uwu</label>
|
||||
<br>
|
||||
<input type="checkbox" id="subUwu" name="subUwu" class="form-check-input ms-0 mt-0" tabindex="6">
|
||||
<br>
|
||||
<div class="form-text">Uwu?</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user