progress
This commit is contained in:
@@ -171,7 +171,7 @@ def update_folder(folder_id):
|
||||
# Folder not found
|
||||
folders = Folder.query.filter_by(user_id=current_user.id).all()
|
||||
return render_template('partials/folders_list.html', folders=folders)
|
||||
|
||||
|
||||
# Get form data
|
||||
name = request.form.get('name')
|
||||
rule_text = request.form.get('rule_text')
|
||||
@@ -234,6 +234,7 @@ def imap_config_modal():
|
||||
server=current_user.imap_config.get('server') if current_user.imap_config else None,
|
||||
port=current_user.imap_config.get('port') if current_user.imap_config else None,
|
||||
username=current_user.imap_config.get('username') if current_user.imap_config else None,
|
||||
password=current_user.imap_config.get('password') if current_user.imap_config else None,
|
||||
use_ssl=current_user.imap_config.get('use_ssl', True) if current_user.imap_config else True))
|
||||
response.headers['HX-Trigger'] = 'open-modal'
|
||||
return response
|
||||
@@ -243,8 +244,6 @@ def imap_config_modal():
|
||||
def test_imap_connection():
|
||||
"""Test IMAP connection with provided configuration."""
|
||||
try:
|
||||
import time
|
||||
time.sleep(5)
|
||||
# Get form data
|
||||
server = request.form.get('server')
|
||||
port = request.form.get('port')
|
||||
@@ -337,4 +336,23 @@ def sync_imap_folders():
|
||||
except Exception as e:
|
||||
logging.exception("Error syncing IMAP folders: %s", e)
|
||||
print(e)
|
||||
return jsonify({'error': 'An unexpected error occurred. Please try again.'}), 500
|
||||
|
||||
@main.route('/api/folders', methods=['GET'])
|
||||
@login_required
|
||||
def get_folders():
|
||||
"""Get folders with optional filtering."""
|
||||
# Get filter parameter from query string
|
||||
filter_type = request.args.get('filter', 'all')
|
||||
|
||||
# Get folders for the current authenticated user
|
||||
if filter_type == 'high':
|
||||
# Get high priority folders (priority = 1)
|
||||
folders = Folder.query.filter_by(user_id=current_user.id, priority=1).all()
|
||||
elif filter_type == 'normal':
|
||||
# Get normal priority folders (priority = 0 or not set)
|
||||
folders = Folder.query.filter_by(user_id=current_user.id).filter(Folder.priority != 1).all()
|
||||
else:
|
||||
# Get all folders
|
||||
folders = Folder.query.filter_by(user_id=current_user.id).all()
|
||||
|
||||
return render_template('partials/folders_list.html', folders=folders)
|
||||
|
||||
Reference in New Issue
Block a user