v1.4: group folder/photo limits and ad banners
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+14
-1
@@ -22,6 +22,7 @@ from app.folder_utils import (
|
||||
unlock_folder,
|
||||
)
|
||||
from app.models import Folder, FolderInvite, FolderMember, Photo, User
|
||||
from app.quota_utils import check_folder_limit
|
||||
from app.settings_service import get_settings
|
||||
from app.storage_service import delete_photo_file
|
||||
|
||||
@@ -31,6 +32,8 @@ bp = Blueprint("folders", __name__)
|
||||
@bp.route("/cabinet/folders")
|
||||
@login_required
|
||||
def list_folders():
|
||||
from app.quota_utils import quota_status
|
||||
|
||||
process_pending_invites(current_user)
|
||||
owned = Folder.query.filter_by(owner_id=current_user.id).order_by(Folder.created_at.desc()).all()
|
||||
shared = (
|
||||
@@ -42,7 +45,12 @@ def list_folders():
|
||||
.order_by(Folder.created_at.desc())
|
||||
.all()
|
||||
)
|
||||
return render_template("cabinet/folders/list.html", owned_folders=owned, shared_folders=shared)
|
||||
return render_template(
|
||||
"cabinet/folders/list.html",
|
||||
owned_folders=owned,
|
||||
shared_folders=shared,
|
||||
quota=quota_status(current_user),
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/cabinet/folders/create", methods=["POST"])
|
||||
@@ -56,6 +64,11 @@ def create_folder():
|
||||
flash("Название папки — минимум 2 символа", "error")
|
||||
return redirect(url_for("folders.list_folders"))
|
||||
|
||||
ok, limit_msg = check_folder_limit(current_user)
|
||||
if not ok:
|
||||
flash(limit_msg, "error")
|
||||
return redirect(url_for("folders.list_folders"))
|
||||
|
||||
folder = Folder(name=name, owner_id=current_user.id, is_private=is_private)
|
||||
if access_password:
|
||||
if len(access_password) < 4:
|
||||
|
||||
Reference in New Issue
Block a user