unique rules functional on sub modal
All checks were successful
Build and Push Docker Image / build (push) Successful in 15s

This commit is contained in:
Corban-Lee Jones 2024-09-15 15:35:01 +01:00
parent 3acb172432
commit 9fb0906723
2 changed files with 35 additions and 1 deletions

View File

@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- `UniqueContentRule` model, allows the user to determine how unique RSS items are defined
- `unique_content_rules` attribute to the `Subscription` model, many-to-many relationship with the related model
- Web interface method of setting a Subscription's unique content rules, through a multi-select field
- Migrations to allow older versions to seemlessly upgrade for this change, by creating the `UniqueContentRule` instances and setting default content rules on Subscriptions
### Fixed
- Footer links pointing to older domain
@ -15,7 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Web interface now uses the full device width, rather than a smaller maximum width
- Server sidebar use more width, also displays name and guild ID, becomes smaller on small devices.
- Server sidebar use more width, also displays name and guild ID, becomes smaller on small devices
- Update changelog to follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
## [0.3.4] - 2024-09-12

View File

@ -65,6 +65,24 @@ async function initSubscriptionTable() {
return `<span class="badge text-bg-secondary">${channelsCount}</span>`;
}
},
{
title: "Content Rules",
data: "unique_content_rules",
className: "text-center text-nowrap",
render: function(data, type) {
console.log(JSON.stringify(data))
let badges = $("<div>");
data.forEach(function(rule, idx) {
let badge = $(`<span class="badge text-bg-secondary">${rule.name}</span>`)
if (idx > 0) { badge.addClass("ms-2") }
badges.append(badge);
});
return badges.html();
}
},
{
title: "Created",
data: "creation_datetime",
@ -210,6 +228,7 @@ async function showEditSubModal(subId) {
$("#subTitleMutators").val("").change();
$("#subDescMutators").val("").change();
$("#subActive").prop("checked", true);
$("#subUniqueRules").val(1).change(); // GUID option selected by default
$("#subEmbedColour .colour-reset").click();
$("#subArticleFetchImage").prop("checked", true);
@ -242,6 +261,9 @@ async function showEditSubModal(subId) {
$("#subFilters").val("").change();
$("#subFilters").val(subscription.filters).change();
$("#subUniqueRules").val("").change();
$("#subUniqueRules").val(subscription.unique_content_rules.map(rule => rule.id)).change();
updateColourInput("subEmbedColour", `#${subscription.embed_colour}`);
$("#subArticleFetchImage").prop("checked", subscription.article_fetch_image);
@ -299,6 +321,11 @@ $("#subForm").on("submit", async function(event) {
filter => formData.append("filters", parseInt(filter.value))
);
// Unique Content Rules
$("#subUniqueRules option:selected").toArray().forEach(
rule => formData.append("unique_content_rules", parseInt(rule.value))
);
// This field is constructed differently, so needs to be specifically added
formData.append("embed_colour", getColourInputVal("subEmbedColour", false));