feat: wire embed param to EmbedProfileTemplate

This commit is contained in:
2026-06-03 10:08:51 +02:00
parent 8ca378b25f
commit 19642175eb

View File

@@ -42,7 +42,7 @@ use application::ports::HtmlPageContext;
use domain::models::ExportFormat; use domain::models::ExportFormat;
use domain::{errors::DomainError, value_objects::UserId}; use domain::{errors::DomainError, value_objects::UserId};
use template_askama::{ use template_askama::{
ActivityFeedTemplate, IntegrationsTemplate, LoginTemplate, MonthlyRatingRow, ActivityFeedTemplate, EmbedProfileTemplate, IntegrationsTemplate, LoginTemplate, MonthlyRatingRow,
MovieDetailTemplate, NewReviewTemplate, ProfileSettingsTemplate, ProfileTemplate, MovieDetailTemplate, NewReviewTemplate, ProfileSettingsTemplate, ProfileTemplate,
RegisterTemplate, RemoteActorData, RemoteActorDisplay, UserSummaryView, UsersTemplate, RegisterTemplate, RemoteActorData, RemoteActorDisplay, UserSummaryView, UsersTemplate,
WatchQueueTemplate, WatchlistTemplate, bar_height_px, build_heatmap, build_page_items, WatchQueueTemplate, WatchlistTemplate, bar_height_px, build_heatmap, build_page_items,
@@ -613,33 +613,63 @@ pub async fn get_user_profile(
.iter() .iter()
.map(crate::mappers::users::pending_follower_data) .map(crate::mappers::users::pending_follower_data)
.collect(); .collect();
render_page(ProfileTemplate { if params.embed {
ctx: &ctx, let profile_url = format!(
profile_display_name: display_name, "{}/users/{}",
profile_user_id: profile_user_uuid, state.app_ctx.config.base_url, profile_user_uuid
stats: &profile.stats, );
avg_rating_display, let response = render_page(EmbedProfileTemplate {
favorite_director_display, profile_display_name: display_name,
most_active_month_display, profile_user_id: profile_user_uuid,
view: profile_view.as_str(), profile_url,
entries: profile.entries.as_ref(), stats: &profile.stats,
current_offset: offset, avg_rating_display,
has_more, favorite_director_display,
limit, most_active_month_display,
history: profile.history.as_ref(), view: profile_view.as_str(),
trends: profile.trends.as_ref(), entries: profile.entries.as_ref(),
monthly_rating_rows, current_offset: offset,
heatmap, has_more,
page_items, limit,
is_own_profile, history: profile.history.as_ref(),
error: params.error, trends: profile.trends.as_ref(),
following_count: profile.following_count, monthly_rating_rows,
followers_count: profile.followers_count, heatmap,
pending_followers, page_items,
sort_by: sort_by_str.to_string(), sort_by: sort_by_str.to_string(),
search: params.search.clone(), });
}) let mut resp = response.into_response();
.into_response() resp.headers_mut().remove("x-frame-options");
resp
} else {
render_page(ProfileTemplate {
ctx: &ctx,
profile_display_name: display_name,
profile_user_id: profile_user_uuid,
stats: &profile.stats,
avg_rating_display,
favorite_director_display,
most_active_month_display,
view: profile_view.as_str(),
entries: profile.entries.as_ref(),
current_offset: offset,
has_more,
limit,
history: profile.history.as_ref(),
trends: profile.trends.as_ref(),
monthly_rating_rows,
heatmap,
page_items,
is_own_profile,
error: params.error,
following_count: profile.following_count,
followers_count: profile.followers_count,
pending_followers,
sort_by: sort_by_str.to_string(),
search: params.search.clone(),
})
.into_response()
}
} }
Err(e) => crate::errors::domain_error_response(e), Err(e) => crate::errors::domain_error_response(e),
} }