Merge branch 'mealie-next' into authelia-docs-update

This commit is contained in:
boc-the-git 2024-03-21 08:01:58 +11:00 committed by GitHub
commit c9d74e25ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 79 additions and 41 deletions

View File

@ -0,0 +1,9 @@
---
title: OAuth setup with <PROVIDER>
body:
- type: textarea
attributes:
label: Configuration Example
description: Add your example configuration. You can provide code blocks, screenshots, and links.
validations:
required: true

View File

@ -6,7 +6,7 @@ This is the start of the maintainers guide for Mealie developers. Those who have
If you are working on issues, it can be helpful to understand the workflow for our repository. When an issue comes in it is tagged with the `bug` and `triage` flags. This is to indicate that they need to be reviewed by a maintainer to determine validity.
After you've reviered an issue it will generally move into one of two states:
After you've reviewed an issue it will generally move into one of two states:
`bug:confirmed`
: Your were able to verify the issue and we determined we need to fix it

View File

@ -1,30 +1,39 @@
import { useAsync, ref } from "@nuxtjs/composition-api";
import { useAsyncKey } from "./use-utils";
import { useUserApi } from "~/composables/api";
import { GroupBase } from "~/lib/api/types/user";
import { GroupBase, GroupSummary } from "~/lib/api/types/user";
const groupSelfRef = ref<GroupSummary | null>(null);
const loading = ref(false);
export const useGroupSelf = function () {
const api = useUserApi();
async function refreshGroupSelf() {
loading.value = true;
const { data } = await api.groups.getCurrentUserGroup();
groupSelfRef.value = data;
loading.value = false;
}
const actions = {
get() {
const group = useAsync(async () => {
const { data } = await api.groups.getCurrentUserGroup();
if (!(groupSelfRef.value || loading.value)) {
refreshGroupSelf();
}
return data;
}, useAsyncKey());
return group;
return groupSelfRef;
},
async updatePreferences() {
if (!group.value?.preferences) {
if (!groupSelfRef.value) {
await refreshGroupSelf();
}
if (!groupSelfRef.value?.preferences) {
return;
}
const { data } = await api.groups.setPreferences(group.value.preferences);
const { data } = await api.groups.setPreferences(groupSelfRef.value.preferences);
if (data) {
group.value.preferences = data;
groupSelfRef.value.preferences = data;
}
},
};

View File

@ -80,7 +80,7 @@
"recipe-events": "Hændelser for opskrifter"
},
"general": {
"add": "Add",
"add": "Tilføj",
"cancel": "Annuller",
"clear": "Ryd",
"close": "Luk",
@ -144,11 +144,11 @@
"save": "Gem",
"settings": "Indstillinger",
"share": "Del",
"show-all": "Show All",
"show-all": "Vis alle",
"shuffle": "Bland",
"sort": "Sorter",
"sort-ascending": "Sort Ascending",
"sort-descending": "Sort Descending",
"sort-ascending": "Sorter stigende",
"sort-descending": "Sorter Faldende",
"sort-alphabetically": "Alfabetisk",
"status": "Status",
"subject": "Emne",
@ -243,8 +243,8 @@
"group-preferences": "Gruppe Indstillinger",
"private-group": "Privat Gruppe",
"private-group-description": "Indstilling af din gruppe til privat, vil ændre alle indstillinger for offentlig visning. Dette tilsidesætter individuelle opskrifters indstillinger for offentlig visning.",
"enable-public-access": "Enable Public Access",
"enable-public-access-description": "Make group recipes public by default, and allow visitors to view recipes without logging-in",
"enable-public-access": "Aktiver Offentlig Adgang",
"enable-public-access-description": "Gør gruppeopskrifter offentlige som standard, og tillade besøgende at se opskrifter uden at logge ind",
"allow-users-outside-of-your-group-to-see-your-recipes": "Tillad brugere udenfor din gruppe at se dine opskrifter",
"allow-users-outside-of-your-group-to-see-your-recipes-description": "Når aktiveret kan du bruge et link til offentlig deling til at dele specifikke opskrifter uden at oprette en bruger. Når deaktiveret, kan du kun dele opskrifter med brugere, der er i din gruppe eller med et prægenereret privat link",
"show-nutrition-information": "Vis ernæringsoplysninger",
@ -358,7 +358,7 @@
},
"recipe-data-migrations": "Migrering af opskrifter",
"recipe-data-migrations-explanation": "Opskrifter kan migreres fra et andet understøttet program til Mealie. Dette er en fantastisk måde at komme i gang med Mealie.",
"coming-from-another-application-or-an-even-older-version-of-mealie": "Coming from another application or an even older version of Mealie? Check out migrations and see if your data can be imported.",
"coming-from-another-application-or-an-even-older-version-of-mealie": "Kommer fra en anden applikation eller en endnu ældre version af Mealie? Tjek migrationer og se om dine data kan importeres.",
"choose-migration-type": "Vælg Migreringstype",
"tag-all-recipes": "Tag alle opskrifter med {tag-name} tag",
"nextcloud-text": "Nextcloud opskrifter kan importeres fra en zip-fil, der indeholder data lagret i Nextcloud. Se eksempelmappestrukturen nedenfor for at sikre, at dine opskrifter kan importeres.",
@ -543,7 +543,7 @@
"import-with-url": "Importér via URL",
"create-recipe": "Opret opskrift",
"create-recipe-description": "Create a new recipe from scratch.",
"create-recipes": "Create Recipes",
"create-recipes": "Opret opskrift",
"import-with-zip": "Importér fra ZIP-fil",
"create-recipe-from-an-image": "Opret opskrift ud fra et billede",
"bulk-url-import": "Import fra flere URL-adresser",
@ -577,7 +577,7 @@
"upload-image": "Upload billede",
"screen-awake": "Hold skærmen tændt",
"remove-image": "Fjern billede",
"nextStep": "Next step"
"nextStep": "Næste trin"
},
"search": {
"advanced-search": "Avanceret søgning",
@ -850,11 +850,11 @@
"link-id": "Link ID",
"link-name": "Linknavn",
"login": "Log på",
"login-oidc": "Login with",
"login-oidc": "Log ind med",
"or": "eller",
"logout": "Log ud",
"manage-users": "Administrer brugere",
"manage-users-description": "Create and manage users.",
"manage-users-description": "Opret og administrér brugere.",
"new-password": "Ny adgangskode",
"new-user": "Ny bruger",
"password-has-been-reset-to-the-default-password": "Adgangskode er blevet nulstillet til systemstandarden",

View File

@ -89,7 +89,7 @@
"confirm-delete-generic": "削除しますか?",
"copied_message": "コピーしました",
"create": "作成",
"created": "作成しました。",
"created": "作成",
"custom": "カスタム",
"dashboard": "ダッシュボード",
"delete": "削除",
@ -164,7 +164,7 @@
"tuesday": "火曜日",
"type": "タイプ",
"update": "更新",
"updated": "更新しました",
"updated": "更新日時",
"upload": "アップロード",
"url": "URL",
"view": "表示",

View File

@ -48,6 +48,13 @@ export interface GroupInDB {
users?: UserOut[];
preferences?: ReadGroupPreferences;
}
export interface GroupSummary {
name: string;
id: string;
slug: string;
preferences?: ReadGroupPreferences;
}
export interface CategoryBase {
name: string;
id: string;

View File

@ -1,5 +1,5 @@
import { BaseCRUDAPI } from "../base/base-clients";
import { CategoryBase, GroupBase, GroupInDB, UserOut } from "~/lib/api/types/user";
import { CategoryBase, GroupBase, GroupInDB, GroupSummary, UserOut } from "~/lib/api/types/user";
import {
CreateInviteToken,
GroupAdminUpdate,
@ -35,7 +35,7 @@ export class GroupAPI extends BaseCRUDAPI<GroupBase, GroupInDB, GroupAdminUpdate
/** Returns the Group Data for the Current User
*/
async getCurrentUserGroup() {
return await this.requests.get<GroupInDB>(routes.groupsSelf);
return await this.requests.get<GroupSummary>(routes.groupsSelf);
}
async getCategories() {

View File

@ -8,7 +8,7 @@ from mealie.routes._base.routers import UserAPIRouter
from mealie.schema.group.group_permissions import SetPermissions
from mealie.schema.group.group_preferences import ReadGroupPreferences, UpdateGroupPreferences
from mealie.schema.group.group_statistics import GroupStatistics, GroupStorage
from mealie.schema.user.user import GroupInDB, UserOut
from mealie.schema.user.user import GroupSummary, UserOut
from mealie.services.group_services.group_service import GroupService
router = UserAPIRouter(prefix="/groups", tags=["Groups: Self Service"])
@ -20,10 +20,10 @@ class GroupSelfServiceController(BaseUserController):
def service(self) -> GroupService:
return GroupService(self.group_id, self.repos)
@router.get("/self", response_model=GroupInDB)
@router.get("/self", response_model=GroupSummary)
def get_logged_in_user_group(self):
"""Returns the Group Data for the Current User"""
return self.group
return self.group.cast(GroupSummary)
@router.get("/members", response_model=list[UserOut])
def get_group_members(self):

View File

@ -249,6 +249,19 @@ class GroupInDB(UpdateGroup):
]
class GroupSummary(GroupBase):
id: UUID4
name: str
slug: str
preferences: ReadGroupPreferences | None = None
@classmethod
def loader_options(cls) -> list[LoaderOption]:
return [
joinedload(Group.preferences),
]
class GroupPagination(PaginationBase):
items: list[GroupInDB]

20
poetry.lock generated
View File

@ -1353,13 +1353,13 @@ min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-imp
[[package]]
name = "mkdocs-material"
version = "9.5.13"
version = "9.5.14"
description = "Documentation that simply works"
optional = false
python-versions = ">=3.8"
files = [
{file = "mkdocs_material-9.5.13-py3-none-any.whl", hash = "sha256:5cbe17fee4e3b4980c8420a04cc762d8dc052ef1e10532abd4fce88e5ea9ce6a"},
{file = "mkdocs_material-9.5.13.tar.gz", hash = "sha256:d8e4caae576312a88fd2609b81cf43d233cdbe36860d67a68702b018b425bd87"},
{file = "mkdocs_material-9.5.14-py3-none-any.whl", hash = "sha256:a45244ac221fda46ecf8337f00ec0e5cb5348ab9ffb203ca2a0c313b0d4dbc27"},
{file = "mkdocs_material-9.5.14.tar.gz", hash = "sha256:2a1f8e67cda2587ab93ecea9ba42d0ca61d1d7b5fad8cf690eeaeb39dcd4b9af"},
]
[package.dependencies]
@ -2105,13 +2105,13 @@ testing = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygm
[[package]]
name = "pytest-asyncio"
version = "0.23.5"
version = "0.23.6"
description = "Pytest support for asyncio"
optional = false
python-versions = ">=3.8"
files = [
{file = "pytest-asyncio-0.23.5.tar.gz", hash = "sha256:3a048872a9c4ba14c3e90cc1aa20cbc2def7d01c7c8db3777ec281ba9c057675"},
{file = "pytest_asyncio-0.23.5-py3-none-any.whl", hash = "sha256:4e7093259ba018d58ede7d5315131d21923a60f8a6e9ee266ce1589685c89eac"},
{file = "pytest-asyncio-0.23.6.tar.gz", hash = "sha256:ffe523a89c1c222598c76856e76852b787504ddb72dd5d9b6617ffa8aa2cde5f"},
{file = "pytest_asyncio-0.23.6-py3-none-any.whl", hash = "sha256:68516fdd1018ac57b846c9846b954f0393b26f094764a28c955eabb0536a4e8a"},
]
[package.dependencies]
@ -2910,13 +2910,13 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
[[package]]
name = "uvicorn"
version = "0.28.0"
version = "0.29.0"
description = "The lightning-fast ASGI server."
optional = false
python-versions = ">=3.8"
files = [
{file = "uvicorn-0.28.0-py3-none-any.whl", hash = "sha256:6623abbbe6176204a4226e67607b4d52cc60ff62cda0ff177613645cefa2ece1"},
{file = "uvicorn-0.28.0.tar.gz", hash = "sha256:cab4473b5d1eaeb5a0f6375ac4bc85007ffc75c3cc1768816d9e5d589857b067"},
{file = "uvicorn-0.29.0-py3-none-any.whl", hash = "sha256:2c2aac7ff4f4365c206fd773a39bf4ebd1047c238f8b8268ad996829323473de"},
{file = "uvicorn-0.29.0.tar.gz", hash = "sha256:6a69214c0b6a087462412670b3ef21224fa48cae0e452b5883e8e8bdfdd11dd0"},
]
[package.dependencies]
@ -3174,4 +3174,4 @@ pgsql = ["psycopg2-binary"]
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "d208e7532a75b0bae2dc41ab9e7a7fe6636d2e3d4c0a4c7a14d47e4639a19d2c"
content-hash = "78284368031f012f6e4edcbb6cc3c25db58f570474e0939e5ed3948c01b9d798"

View File

@ -38,7 +38,7 @@ python-slugify = "^8.0.0"
recipe-scrapers = "^14.53.0"
requests = "^2.31.0"
tzdata = "^2023.4"
uvicorn = { extras = ["standard"], version = "^0.28.0" }
uvicorn = { extras = ["standard"], version = "^0.29.0" }
beautifulsoup4 = "^4.11.2"
isodate = "^0.6.1"
text-unidecode = "^1.3"