Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(news): subscription folder dropdown never loads and folder selection is dropped (#4495)

LearningCircuite1a2d19da3ae
diff --git a/src/local_deep_research/web/static/js/pages/news.js b/src/local_deep_research/web/static/js/pages/news.js
index a11c0077df..e2230a7003 100644
--- a/src/local_deep_research/web/static/js/pages/news.js
+++ b/src/local_deep_research/web/static/js/pages/news.js
@@ -3647,8 +3647,11 @@ async function handleNewsSubscriptionSubmit(e) {
},
body: JSON.stringify({
query,
+ name,
subscription_type: 'search',
refresh_minutes: parseInt(frequency, 10),
+ folder_id: folder || null,
+ is_active: isActive,
model_provider: modelProvider,
model,
search_strategy: searchStrategy
@@ -3744,7 +3747,7 @@ async function loadSubscriptionFolders() {
// Add folder options
folders.forEach(folder => {
const option = document.createElement('option');
- option.value = folder.name;
+ option.value = folder.id;
option.textContent = `${folder.icon || '📁'} ${folder.name}`;
select.appendChild(option);
});
diff --git a/src/local_deep_research/web/templates/pages/news-subscription-form.html b/src/local_deep_research/web/templates/pages/news-subscription-form.html
index 41e6c41164..c772c15cef 100644
--- a/src/local_deep_research/web/templates/pages/news-subscription-form.html
+++ b/src/local_deep_research/web/templates/pages/news-subscription-form.html
@@ -558,11 +558,12 @@ document.addEventListener('DOMContentLoaded', async function() {
// Load subscription folders
async function loadSubscriptionFolders() {
try {
- const response = await fetch('/news/api/folders', {
+ const response = await fetch('/news/api/subscription/folders', {
credentials: 'same-origin'
});
if (response.ok) {
const data = await response.json();
+ const folders = Array.isArray(data) ? data : (data.folders || []);
const select = document.getElementById('subscription-folder');
// Clear existing options except first
@@ -571,7 +572,7 @@ async function loadSubscriptionFolders() {
}
// Add folders
- data.folders.forEach(folder => {
+ folders.forEach(folder => {
const option = document.createElement('option');
option.value = folder.id;
option.textContent = folder.name;
@@ -582,6 +583,8 @@ async function loadSubscriptionFolders() {
{% if subscription and subscription.folder_id %}
select.value = "{{ subscription.folder_id }}";
{% endif %}
+ } else {
+ console.error('Failed to load folders:', response.status, response.statusText);
}
} catch (error) {
console.error('Error loading folders:', error);
diff --git a/tests/news/test_flask_api.py b/tests/news/test_flask_api.py
index b2aaff4d88..c5d0103d5c 100644
--- a/tests/news/test_flask_api.py
+++ b/tests/news/test_flask_api.py
@@ -177,21 +177,21 @@ class TestFolderEndpoints:
def test_folders_endpoint_requires_auth(self, client):
"""Test that folders endpoint requires authentication."""
- response = client.get("/news/api/folders")
+ response = client.get("/news/api/subscription/folders")
# Should require auth
- assert response.status_code == 404, response.status_code
+ assert response.status_code == 401, response.status_code
def test_create_folder_requires_auth(self, client):
"""Test that create folder endpoint requires authentication."""
response = client.post(
- "/news/api/folders",
+ "/news/api/subscription/folders",
json={"name": "Test Folder"},
content_type="application/json",
)
# Should require auth
- assert response.status_code == 404, response.status_code
+ assert response.status_code == 401, response.status_code
class TestSchedulerEndpoints:
@@ -1034,7 +1034,7 @@ class TestErrorHandling:
endpoints = [
("/news/api/feed", "GET"),
("/news/api/subscriptions", "GET"),
- ("/news/api/folders", "GET"),
+ ("/news/api/subscription/folders", "GET"),
]
for endpoint, method in endpoints:
diff --git a/tests/news/test_flask_api_coverage.py b/tests/news/test_flask_api_coverage.py
index 9f74f8d5f4..b3eda7a00c 100644
--- a/tests/news/test_flask_api_coverage.py
+++ b/tests/news/test_flask_api_coverage.py
@@ -53,6 +53,32 @@ class TestSubscribe:
assert resp.get_json()["id"] == "s1"
assert m.call_args.kwargs["query"] == "AI news"
+ def test_folder_name_and_active_forwarded(self, client):
+ """folder_id, name and is_active from the request body must reach
+ api.create_subscription (regression test for #4489, where the
+ frontend dropped these fields)."""
+ _auth(client)
+ with (
+ patch(f"{MODULE}.get_user_id", return_value="testuser"),
+ patch(
+ f"{MODULE}.api.create_subscription", return_value={"id": "s1"}
+ ) as m,
+ ):
+ resp = client.post(
+ "/news/api/subscribe",
+ json={
+ "query": "AI news",
+ "name": "My subscription",
+ "folder_id": "7f3d2a10-0000-0000-0000-000000000000",
+ "is_active": False,
+ },
+ )
+ assert resp.status_code == 200
+ kwargs = m.call_args.kwargs
+ assert kwargs["folder_id"] == "7f3d2a10-0000-0000-0000-000000000000"
+ assert kwargs["name"] == "My subscription"
+ assert kwargs["is_active"] is False
+
def test_missing_query_returns_400(self, client):
_auth(client)
with patch(f"{MODULE}.get_user_id", return_value="testuser"):