mentions
This commit is contained in:
parent
bfc2d71ca0
commit
6f7d0f67b3
@ -420,12 +420,11 @@ pub async fn create_reminder(
|
|||||||
interval_seconds,
|
interval_seconds,
|
||||||
interval_months,
|
interval_months,
|
||||||
name,
|
name,
|
||||||
pin,
|
|
||||||
restartable,
|
restartable,
|
||||||
tts,
|
tts,
|
||||||
username,
|
username,
|
||||||
`utc_time`
|
`utc_time`
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||||
new_uid,
|
new_uid,
|
||||||
attachment_data,
|
attachment_data,
|
||||||
reminder.attachment_name,
|
reminder.attachment_name,
|
||||||
@ -447,7 +446,6 @@ pub async fn create_reminder(
|
|||||||
reminder.interval_seconds,
|
reminder.interval_seconds,
|
||||||
reminder.interval_months,
|
reminder.interval_months,
|
||||||
name,
|
name,
|
||||||
reminder.pin,
|
|
||||||
reminder.restartable,
|
reminder.restartable,
|
||||||
reminder.tts,
|
reminder.tts,
|
||||||
reminder.username,
|
reminder.username,
|
||||||
@ -479,7 +477,6 @@ pub async fn create_reminder(
|
|||||||
reminders.interval_seconds,
|
reminders.interval_seconds,
|
||||||
reminders.interval_months,
|
reminders.interval_months,
|
||||||
reminders.name,
|
reminders.name,
|
||||||
reminders.pin,
|
|
||||||
reminders.restartable,
|
reminders.restartable,
|
||||||
reminders.tts,
|
reminders.tts,
|
||||||
reminders.uid,
|
reminders.uid,
|
||||||
@ -543,7 +540,6 @@ pub async fn get_reminders(id: u64, ctx: &State<Context>, pool: &State<Pool<MySq
|
|||||||
reminders.interval_seconds,
|
reminders.interval_seconds,
|
||||||
reminders.interval_months,
|
reminders.interval_months,
|
||||||
reminders.name,
|
reminders.name,
|
||||||
reminders.pin,
|
|
||||||
reminders.restartable,
|
reminders.restartable,
|
||||||
reminders.tts,
|
reminders.tts,
|
||||||
reminders.uid,
|
reminders.uid,
|
||||||
@ -600,7 +596,6 @@ pub async fn edit_reminder(
|
|||||||
interval_seconds,
|
interval_seconds,
|
||||||
interval_months,
|
interval_months,
|
||||||
name,
|
name,
|
||||||
pin,
|
|
||||||
restartable,
|
restartable,
|
||||||
tts,
|
tts,
|
||||||
username,
|
username,
|
||||||
@ -687,7 +682,6 @@ pub async fn edit_reminder(
|
|||||||
reminders.interval_seconds,
|
reminders.interval_seconds,
|
||||||
reminders.interval_months,
|
reminders.interval_months,
|
||||||
reminders.name,
|
reminders.name,
|
||||||
reminders.pin,
|
|
||||||
reminders.restartable,
|
reminders.restartable,
|
||||||
reminders.tts,
|
reminders.tts,
|
||||||
reminders.uid,
|
reminders.uid,
|
||||||
|
@ -97,7 +97,6 @@ pub struct Reminder {
|
|||||||
interval_months: Option<u32>,
|
interval_months: Option<u32>,
|
||||||
#[serde(default = "name_default")]
|
#[serde(default = "name_default")]
|
||||||
name: String,
|
name: String,
|
||||||
pin: bool,
|
|
||||||
restartable: bool,
|
restartable: bool,
|
||||||
tts: bool,
|
tts: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
@ -151,8 +150,6 @@ pub struct PatchReminder {
|
|||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
name: Unset<String>,
|
name: Unset<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pin: Unset<bool>,
|
|
||||||
#[serde(default)]
|
|
||||||
restartable: Unset<bool>,
|
restartable: Unset<bool>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
tts: Unset<bool>,
|
tts: Unset<bool>,
|
||||||
@ -213,8 +210,8 @@ mod base64s {
|
|||||||
where
|
where
|
||||||
D: Deserializer<'de>,
|
D: Deserializer<'de>,
|
||||||
{
|
{
|
||||||
let string = String::deserialize(deserializer)?;
|
let string = Option::<String>::deserialize(deserializer)?;
|
||||||
Some(base64::decode(string).map_err(de::Error::custom)).transpose()
|
Some(string.map(|b| base64::decode(b).map_err(de::Error::custom))).flatten().transpose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +288,10 @@ textarea, input {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input.default-width {
|
||||||
|
width: initial;
|
||||||
|
}
|
||||||
|
|
||||||
.message-input:placeholder-shown {
|
.message-input:placeholder-shown {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
|
@ -14,8 +14,16 @@ const $deleteTemplateBtn = document.querySelector("button#delete-template");
|
|||||||
const $templateSelect = document.querySelector("select#templateSelect");
|
const $templateSelect = document.querySelector("select#templateSelect");
|
||||||
|
|
||||||
let channels = [];
|
let channels = [];
|
||||||
|
let guildNames = {};
|
||||||
let roles = [];
|
let roles = [];
|
||||||
let templates = {};
|
let templates = {};
|
||||||
|
let mentions = new Tribute({
|
||||||
|
values: [],
|
||||||
|
allowSpaces: true,
|
||||||
|
selectTemplate: (item) => {
|
||||||
|
return `<@&${item.original.value}>`;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
let globalPatreon = false;
|
let globalPatreon = false;
|
||||||
let guildPatreon = false;
|
let guildPatreon = false;
|
||||||
@ -32,18 +40,6 @@ function intToColor(i) {
|
|||||||
return `#${i.toString(16).padStart(6, "0")}`;
|
return `#${i.toString(16).padStart(6, "0")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resize_textareas() {
|
|
||||||
document.querySelectorAll("textarea.autoresize").forEach((element) => {
|
|
||||||
element.style.height = "";
|
|
||||||
element.style.height = element.scrollHeight + 3 + "px";
|
|
||||||
|
|
||||||
element.addEventListener("input", () => {
|
|
||||||
element.style.height = "";
|
|
||||||
element.style.height = element.scrollHeight + 3 + "px";
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function switch_pane(selector) {
|
function switch_pane(selector) {
|
||||||
document.querySelectorAll("aside a").forEach((el) => {
|
document.querySelectorAll("aside a").forEach((el) => {
|
||||||
el.classList.remove("is-active");
|
el.classList.remove("is-active");
|
||||||
@ -53,8 +49,6 @@ function switch_pane(selector) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById(selector).classList.remove("is-hidden");
|
document.getElementById(selector).classList.remove("is-hidden");
|
||||||
|
|
||||||
resize_textareas();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_select(sel) {
|
function update_select(sel) {
|
||||||
@ -98,7 +92,16 @@ function fetch_roles(guild_id) {
|
|||||||
if (data.error) {
|
if (data.error) {
|
||||||
show_error(data.error);
|
show_error(data.error);
|
||||||
} else {
|
} else {
|
||||||
roles = data;
|
let values = Array.from(
|
||||||
|
data.map((role) => {
|
||||||
|
return {
|
||||||
|
key: role.name,
|
||||||
|
value: role.id,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
mentions.collection[0].values = values;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -171,6 +174,8 @@ async function fetch_reminders(guild_id) {
|
|||||||
newFrame.querySelector(".reminderContent").dataset["uid"] =
|
newFrame.querySelector(".reminderContent").dataset["uid"] =
|
||||||
reminder["uid"];
|
reminder["uid"];
|
||||||
|
|
||||||
|
mentions.attach(newFrame.querySelector("textarea"));
|
||||||
|
|
||||||
deserialize_reminder(reminder, newFrame, "load");
|
deserialize_reminder(reminder, newFrame, "load");
|
||||||
|
|
||||||
$reminderBox.appendChild(newFrame);
|
$reminderBox.appendChild(newFrame);
|
||||||
@ -312,7 +317,6 @@ async function serialize_reminder(node, mode) {
|
|||||||
interval_seconds: mode !== "template" ? interval.seconds : null,
|
interval_seconds: mode !== "template" ? interval.seconds : null,
|
||||||
interval_months: mode !== "template" ? interval.months : null,
|
interval_months: mode !== "template" ? interval.months : null,
|
||||||
name: node.querySelector('input[name="name"]').value,
|
name: node.querySelector('input[name="name"]').value,
|
||||||
pin: node.querySelector('input[name="pin"]').checked,
|
|
||||||
tts: node.querySelector('input[name="tts"]').checked,
|
tts: node.querySelector('input[name="tts"]').checked,
|
||||||
username: node.querySelector('input[name="username"]').value,
|
username: node.querySelector('input[name="username"]').value,
|
||||||
utc_time: utc_time,
|
utc_time: utc_time,
|
||||||
@ -400,6 +404,7 @@ document.addEventListener("guildSwitched", async (e) => {
|
|||||||
.querySelectorAll(".patreon-only")
|
.querySelectorAll(".patreon-only")
|
||||||
.forEach((el) => el.classList.remove("is-locked"));
|
.forEach((el) => el.classList.remove("is-locked"));
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_roles(e.detail.guild_id);
|
fetch_roles(e.detail.guild_id);
|
||||||
fetch_templates(e.detail.guild_id);
|
fetch_templates(e.detail.guild_id);
|
||||||
await fetch_channels(e.detail.guild_id);
|
await fetch_channels(e.detail.guild_id);
|
||||||
@ -414,8 +419,6 @@ document.addEventListener("guildSwitched", async (e) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
resize_textareas();
|
|
||||||
|
|
||||||
$loader.classList.add("is-hidden");
|
$loader.classList.add("is-hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -553,6 +556,8 @@ document.querySelectorAll(".show-modal").forEach((element) => {
|
|||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
$loader.classList.remove("is-hidden");
|
$loader.classList.remove("is-hidden");
|
||||||
|
|
||||||
|
mentions.attach(document.querySelectorAll("textarea"));
|
||||||
|
|
||||||
document.querySelectorAll(".navbar-burger").forEach((el) => {
|
document.querySelectorAll(".navbar-burger").forEach((el) => {
|
||||||
el.addEventListener("click", () => {
|
el.addEventListener("click", () => {
|
||||||
const target = el.dataset["target"];
|
const target = el.dataset["target"];
|
||||||
@ -591,6 +596,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
const $template = document.getElementById("guildListEntry");
|
const $template = document.getElementById("guildListEntry");
|
||||||
|
|
||||||
for (let guild of data) {
|
for (let guild of data) {
|
||||||
|
guildNames[guild.id] = guild.name;
|
||||||
|
|
||||||
document.querySelectorAll(".guildList").forEach((element) => {
|
document.querySelectorAll(".guildList").forEach((element) => {
|
||||||
const $clone = $template.content.cloneNode(true);
|
const $clone = $template.content.cloneNode(true);
|
||||||
const $anchor = $clone.querySelector("a");
|
const $anchor = $clone.querySelector("a");
|
||||||
@ -607,11 +614,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
|
|
||||||
$anchor.addEventListener("click", async (e) => {
|
$anchor.addEventListener("click", async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.history.pushState(
|
window.history.pushState({}, "", `/dashboard/${guild.id}`);
|
||||||
{},
|
|
||||||
"",
|
|
||||||
`/dashboard/${guild.id}?name=${guild.name}`
|
|
||||||
);
|
|
||||||
const event = new CustomEvent("guildSwitched", {
|
const event = new CustomEvent("guildSwitched", {
|
||||||
detail: {
|
detail: {
|
||||||
guild_name: guild.name,
|
guild_name: guild.name,
|
||||||
@ -629,8 +632,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
const matches = window.location.href.match(/dashboard\/(\d+)/);
|
const matches = window.location.href.match(/dashboard\/(\d+)/);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
let id = matches[1];
|
let id = matches[1];
|
||||||
let name =
|
let name = guildNames[id];
|
||||||
new URLSearchParams(window.location.search).get("name") || id;
|
|
||||||
const event = new CustomEvent("guildSwitched", {
|
const event = new CustomEvent("guildSwitched", {
|
||||||
detail: {
|
detail: {
|
||||||
guild_name: name,
|
guild_name: name,
|
||||||
@ -923,7 +926,6 @@ document.addEventListener("DOMNodeInserted", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
check_embed_fields();
|
check_embed_fields();
|
||||||
resize_textareas();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("click", (ev) => {
|
document.addEventListener("click", (ev) => {
|
||||||
|
@ -27,8 +27,10 @@
|
|||||||
<link rel="stylesheet" href="/static/css/font.css">
|
<link rel="stylesheet" href="/static/css/font.css">
|
||||||
<link rel="stylesheet" href="/static/css/style.css">
|
<link rel="stylesheet" href="/static/css/style.css">
|
||||||
<link rel="stylesheet" href="/static/css/dtsel.css">
|
<link rel="stylesheet" href="/static/css/dtsel.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tributejs/5.1.3/tribute.css" integrity="sha512-GnwBnXd+ZGO9CdP343MUr0jCcJXCr++JVtQRnllexRW2IDq4Zvrh/McTQjooAKnSUbXZ7wamp7AQSweTnfMVoA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||||
|
|
||||||
<script src="/static/js/luxon.min.js"></script>
|
<script src="/static/js/luxon.min.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/tributejs/5.1.3/tribute.min.js" integrity="sha512-KJYWC7RKz/Abtsu1QXd7VJ1IJua7P7GTpl3IKUqfa21Otg2opvRYmkui/CXBC6qeDYCNlQZ7c+7JfDXnKdILUA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar is-spaced is-size-4 is-hidden-desktop dashboard-navbar" role="navigation"
|
<nav class="navbar is-spaced is-size-4 is-hidden-desktop dashboard-navbar" role="navigation"
|
||||||
@ -173,6 +175,36 @@
|
|||||||
<button class="delete close-modal" aria-label="close"></button>
|
<button class="delete close-modal" aria-label="close"></button>
|
||||||
</header>
|
</header>
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
|
<div class="control">
|
||||||
|
<div class="field">
|
||||||
|
<input type="checkbox" class="default-width">
|
||||||
|
<label>Reminders</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<div class="field">
|
||||||
|
<input type="checkbox" class="default-width">
|
||||||
|
<label>Todo Lists</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<div class="field">
|
||||||
|
<input type="checkbox" class="default-width">
|
||||||
|
<label>Timers</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<div class="field">
|
||||||
|
<input type="checkbox" class="default-width">
|
||||||
|
<label>Reminder templates</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<div class="field">
|
||||||
|
<input type="checkbox" class="default-width">
|
||||||
|
<label>Macros</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="has-text-centered">
|
<div class="has-text-centered">
|
||||||
<button class="button is-success is-outlined" id="import-data">Import Data</button>
|
<button class="button is-success is-outlined" id="import-data">Import Data</button>
|
||||||
<button class="button is-success" id="export-data">Export Data</button>
|
<button class="button is-success" id="export-data">Export Data</button>
|
||||||
|
@ -125,7 +125,7 @@
|
|||||||
<p class="title">Import/Export</p>
|
<p class="title">Import/Export</p>
|
||||||
<p class="subtitle">Learn how to import and export data from the dashboard</p>
|
<p class="subtitle">Learn how to import and export data from the dashboard</p>
|
||||||
<div class="content has-text-centered">
|
<div class="content has-text-centered">
|
||||||
<a class="button is-size-4 is-rounded is-light" href="/help/macros">
|
<a class="button is-size-4 is-rounded is-light" href="/help/iemanager">
|
||||||
<p class="is-size-4">
|
<p class="is-size-4">
|
||||||
Read <span class="icon"><i class="fas fa-chevron-right"></i></span>
|
Read <span class="icon"><i class="fas fa-chevron-right"></i></span>
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user