Skip to content

Commit

Permalink
fix: Recipe comments display a username/id rather than … (#4726)
Browse files Browse the repository at this point in the history
Co-authored-by: Kuchenpirat <[email protected]>
Co-authored-by: Kuchenpirat <[email protected]>
  • Loading branch information
3 people authored Jan 14, 2025
1 parent 376c14b commit 4b992af
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<UserAvatar :tooltip="false" size="40" :user-id="comment.userId" />
<v-card outlined class="flex-grow-1">
<v-card-text class="pa-3 pb-0">
<p class="">{{ comment.user.username }} • {{ $d(Date.parse(comment.createdAt), "medium") }}</p>
<p class="">{{ comment.user.fullName }} • {{ $d(Date.parse(comment.createdAt), "medium") }}</p>
<SafeMarkdown :source="comment.text" />
</v-card-text>
<v-card-actions class="justify-end mt-0 pt-0">
Expand Down
1 change: 1 addition & 0 deletions mealie/schema/recipe/recipe_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class UserBase(MealieModel):
id: UUID4
username: str | None = None
admin: bool
full_name: str | None = None
model_config = ConfigDict(from_attributes=True)


Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/fixture_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def admin_user(session: Session, api_client: TestClient):
user_id=user_id,
password=settings._DEFAULT_PASSWORD,
username=user_data.get("username"),
full_name=user_data.get("fullName"),
email=user_data.get("email"),
token=token,
repos=get_repositories(session, group_id=group_id, household_id=household_id),
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/fixture_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def build_unique_user(session: Session, group: str, api_client: TestClient) -> u
user_id=user_id,
email=user_data.get("email"),
username=user_data.get("username"),
full_name=user_data.get("fullName"),
password=registration.password,
token=token,
repos=get_repositories(session, group_id=group_id, household_id=household_id),
Expand Down Expand Up @@ -108,6 +109,7 @@ def h2_user(session: Session, admin_token, api_client: TestClient, unique_user:
token=token,
email=user_data["email"],
username=user_data["username"],
full_name=user_data["fullName"],
password=user_data["password"],
repos=get_repositories(session, group_id=group_id, household_id=household_id),
)
Expand Down Expand Up @@ -165,6 +167,7 @@ def g2_user(session: Session, admin_token, api_client: TestClient):
token=token,
email=create_data["email"], # type: ignore
username=create_data.get("username"), # type: ignore
full_name=create_data.get("fullName"), # type: ignore
password=create_data.get("password"), # type: ignore
repos=get_repositories(session, group_id=group_id, household_id=household_id),
)
Expand Down Expand Up @@ -203,6 +206,7 @@ def _unique_user(session: Session, api_client: TestClient):
user_id=user_id,
email=user_data.get("email"),
username=user_data.get("username"),
full_name=user_data.get("fullName"),
password=registration.password,
token=token,
repos=get_repositories(session, group_id=group_id, household_id=household_id),
Expand Down Expand Up @@ -281,6 +285,7 @@ def user_tuple(session: Session, admin_token, api_client: TestClient) -> Generat
_household_id=household_id,
user_id=user_id,
username=user_data.get("username"),
full_name=user_data.get("fullName"),
email=user_data.get("email"),
password="useruser",
token=token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def test_create_comment(api_client: TestClient, unique_recipe: Recipe, unique_us
assert response_data["recipeId"] == str(unique_recipe.id)
assert response_data["text"] == create_data["text"]
assert response_data["userId"] == str(unique_user.user_id)
assert response_data["user"]["fullName"] == unique_user.full_name

# Check for Proper Association
response = api_client.get(api_routes.recipes_slug_comments(unique_recipe.slug), headers=unique_user.token)
Expand Down
1 change: 1 addition & 0 deletions tests/utils/fixture_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TestUser:
email: str
user_id: UUID
username: str
full_name: str
password: str
_group_id: UUID
_household_id: UUID
Expand Down

0 comments on commit 4b992af

Please sign in to comment.