Rename 'published' to 'public' (for recipe)

This commit is contained in:
Greg Burri 2025-04-02 01:53:02 +02:00
parent eaef6dc77e
commit 4f739593b8
20 changed files with 92 additions and 91 deletions

View file

@ -44,14 +44,11 @@ pub async fn edit(
if let Some(recipe) = connection.get_recipe(recipe_id, false).await? {
if model::can_user_edit_recipe(user, &recipe) {
let recipes = Recipes {
published: connection
.get_all_published_recipe_titles(
context.tr.current_lang_code(),
Some(user.id),
)
public: connection
.get_all_public_recipe_titles(context.tr.current_lang_code(), Some(user.id))
.await?,
unpublished: connection
.get_all_unpublished_recipe_titles(user.id)
private: connection
.get_all_private_recipe_titles(user.id)
.await?,
current_id: Some(recipe_id),
};
@ -98,7 +95,7 @@ pub async fn view(
) -> Result<Response> {
match connection.get_recipe(recipe_id, true).await? {
Some(recipe) => {
if !recipe.is_published
if !recipe.is_public
&& (context.user.is_none() || recipe.user_id != context.user.as_ref().unwrap().id)
{
return Ok(Html(
@ -115,15 +112,15 @@ pub async fn view(
}
let recipes = Recipes {
published: connection
.get_all_published_recipe_titles(
public: connection
.get_all_public_recipe_titles(
context.tr.current_lang_code(),
context.user.as_ref().map(|u| u.id),
)
.await?,
unpublished: if let Some(user) = context.user.as_ref() {
private: if let Some(user) = context.user.as_ref() {
connection
.get_all_unpublished_recipe_titles(user.id)
.get_all_private_recipe_titles(user.id)
.await?
} else {
vec![]