fix: survey invite links use FRONTEND_URL config instead of hardcoded URL
PR environments were generating survey links pointing to production (resolutionflow.com) because the URL was hardcoded. Now uses the existing settings.FRONTEND_URL, falling back to localhost (debug) or production (release). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,11 +29,14 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter(prefix="/admin", tags=["admin-survey"])
|
||||
|
||||
FRONTEND_URL = "https://resolutionflow.com"
|
||||
def _get_frontend_url() -> str:
|
||||
if settings.FRONTEND_URL:
|
||||
return settings.FRONTEND_URL
|
||||
return "http://localhost:5173" if settings.DEBUG else "https://resolutionflow.com"
|
||||
|
||||
|
||||
def _build_invite_response(invite: SurveyInvite) -> SurveyInviteResponse:
|
||||
base_url = FRONTEND_URL if not settings.DEBUG else "http://localhost:5173"
|
||||
base_url = _get_frontend_url()
|
||||
return SurveyInviteResponse(
|
||||
id=str(invite.id),
|
||||
token=invite.token,
|
||||
@@ -63,7 +66,7 @@ async def create_survey_invite(
|
||||
|
||||
if data.send_email and data.recipient_email:
|
||||
try:
|
||||
base_url = FRONTEND_URL if not settings.DEBUG else "http://localhost:5173"
|
||||
base_url = _get_frontend_url()
|
||||
survey_url = f"{base_url}/survey?t={invite.token}"
|
||||
sent = await EmailService.send_survey_invite_email(
|
||||
to_email=data.recipient_email,
|
||||
|
||||
Reference in New Issue
Block a user