fix(marketing): call marketing.landing view directly (avoid redirect loop)

recordings.index previously redirected anonymous users to
url_for('marketing.landing'), but both endpoints are mounted at '/'.
Since recordings_bp registers first, Flask's URL map routed back to
recordings.index -> infinite redirect loop. Now we invoke the marketing
landing view function directly for anonymous requests, preserving the
URL map and avoiding the loop.
This commit is contained in:
Allison
2026-04-27 16:31:31 -04:00
parent 1071e56173
commit af2953995c
2 changed files with 62 additions and 35 deletions

View File

@@ -39,6 +39,7 @@ from src.file_exporter import export_recording, mark_export_as_deleted
from src.utils.ffprobe import get_codec_info, get_creation_date, FFProbeError
from src.utils.audio_conversion import convert_if_needed
from src.utils.file_hash import compute_file_sha256
from src.marketing.routes import landing as _marketing_landing
# Create blueprint
recordings_bp = Blueprint('recordings', __name__)
@@ -1360,16 +1361,22 @@ def reset_status(recording_id):
def index():
"""Root route handler.
Anonymous users are redirected to the marketing landing page so the
public site is reachable at "/". Authenticated users continue to see
the recordings dashboard (legacy Speakr UI).
Anonymous users see the marketing landing page so the public site is
reachable at "/". Authenticated users continue to see the recordings
dashboard (legacy Speakr UI).
Phase 1 of marketing redesign 2026 (B-1.3) replaced the previous
@login_required decorator with this inline check to resolve the route
collision between recordings_bp.index and marketing_bp.landing.
NOTE: We invoke the marketing.landing view function directly (rather
than redirecting via url_for('marketing.landing')) because both
endpoints are mounted at "/". Since recordings_bp is registered first,
Flask's URL map resolves "/" to recordings.index, so a redirect would
loop back into this same handler indefinitely.
"""
if not current_user.is_authenticated:
return redirect(url_for('marketing.landing'))
return _marketing_landing()
# Check if user is a group admin
is_team_admin = GroupMembership.query.filter_by(