This commit is contained in:
Corban-Lee Jones 2024-05-28 22:30:47 +01:00
commit 105052f02e
4 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 5.0.1 on 2024-05-07 09:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0020_remove_savedguilds_unique_name_guild_id_pair_and_more'),
]
operations = [
migrations.AlterField(
model_name='subscription',
name='filters',
field=models.ManyToManyField(to='home.filter'),
),
]

View File

@ -216,7 +216,7 @@ class Subscription(models.Model):
blank=True,
)
filters = models.ManyToManyField(to="home.Filter", null=True, blank=True)
filters = models.ManyToManyField(to="home.Filter", blank=True)
active = models.BooleanField(
default=True,
@ -246,4 +246,3 @@ class Subscription(models.Model):
new_text = "New " if self._state.adding else ""
log.debug("%sSubscription Saved %s", new_text, self.id)
super().save(*args, **kwargs)

View File

@ -256,6 +256,7 @@ async function loadChannelOptions(guildId) {
}
if (channels.code === 50001) {
showServerJoinAlert();
throw new Error(
`Unable to retrieve channels from Guild '${guildId}'.
Ensure that @PYRSS is a member with permissions
@ -317,4 +318,16 @@ async function loadFilterOptions(guildId) {
$("#subFilters").prop("disabled", false);
}
}
function showServerJoinAlert() {
const guildId = getCurrentlyActiveServer().guild_id;
const inviteUrl = `https://discord.com/oauth2/authorize
?client_id=1129345991758336020
&permissions=2147534848&scope=bot+applications.commands
&guild_id=${guildId}
&disable_guild_select=true`
$("#serverJoinAlert a.alert-link").attr("href", inviteUrl);
$("#serverJoinAlert").show();
}

View File

@ -37,6 +37,18 @@
</div>
</div>
<div class="col-12 m-0">
<div id="serverJoinAlert" class="alert alert-warning alert-dismissable fade show mt-4 d-flex align-items-center" role="alert" style="display: hidden">
<i class="bi bi-warning"></i>
<span>
<strong>Warning:</strong>
The Bot isn't a member of this server, please <a href="" class="alert-link">invite the bot</a> to use it.
</span>
<button type="button" class="btn-close ms-auto" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
<div class="col-12">
<div class="d-flex px-3 pt-4 pb-2">
<ul id="serverTabs" class="nav nav-pills me-auto" role="tablist">