mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
fix: Recipe comments display a username/id rather than … (#4726)
Co-authored-by: Kuchenpirat <jojow@gmx.net> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
376c14be9a
commit
4b992afc67
6 changed files with 10 additions and 1 deletions
|
@ -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">
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
1
tests/fixtures/fixture_admin.py
vendored
1
tests/fixtures/fixture_admin.py
vendored
|
@ -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),
|
||||
|
|
5
tests/fixtures/fixture_users.py
vendored
5
tests/fixtures/fixture_users.py
vendored
|
@ -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),
|
||||
|
@ -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),
|
||||
)
|
||||
|
@ -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),
|
||||
)
|
||||
|
@ -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),
|
||||
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -11,6 +11,7 @@ class TestUser:
|
|||
email: str
|
||||
user_id: UUID
|
||||
username: str
|
||||
full_name: str
|
||||
password: str
|
||||
_group_id: UUID
|
||||
_household_id: UUID
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue