Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Fix folders feature detection in account settings

Murtaza Nasira89472ecf64d
diff --git a/src/api/folders.py b/src/api/folders.py
index 59c6d2fa..4cff61e2 100644
--- a/src/api/folders.py
+++ b/src/api/folders.py
@@ -44,10 +44,10 @@ def init_folders_helpers(**kwargs):
@login_required
def get_folders():
"""Get all folders for the current user, including group folders they have access to."""
- # Check if folders feature is enabled
+ # Check if folders feature is enabled - return empty array if not
folders_enabled = SystemSetting.get_setting('enable_folders', 'false')
if folders_enabled != 'true':
- return jsonify({'error': 'Folders feature is not enabled'}), 403
+ return jsonify([])
# Get user's personal folders
user_folders = Folder.query.filter_by(user_id=current_user.id, group_id=None).order_by(Folder.name).all()
diff --git a/templates/account.html b/templates/account.html
index 85bc3477..7b0b3a21 100644
--- a/templates/account.html
+++ b/templates/account.html
@@ -4651,11 +4651,10 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co
// Check if folders feature is enabled and show/hide the tab
async function checkFoldersEnabled() {
try {
- const response = await fetch('/api/admin/settings');
+ const response = await fetch('/api/config');
if (response.ok) {
- const settings = await response.json();
- const foldersSetting = settings.find(s => s.key === 'enable_folders');
- foldersEnabled = foldersSetting && foldersSetting.value === 'true';
+ const config = await response.json();
+ foldersEnabled = config.enable_folders === true;
if (foldersEnabled && tabFolders) {
tabFolders.style.display = '';