From 05c140da78a0ce5dee72ecc564c4d6c9ec3e3427 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 3 Feb 2021 00:11:48 +0000 Subject: [PATCH] Update docs, rename desc to long_description --- app/flatpages/help/api.md | 4 ++-- app/flatpages/help/package_config.md | 14 ++++++++------ app/flatpages/help/update_config.md | 7 ++++--- app/logic/packages.py | 10 +++++++++- app/models/packages.py | 2 +- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/flatpages/help/api.md b/app/flatpages/help/api.md index 0d9022cd..f3aae9e3 100644 --- a/app/flatpages/help/api.md +++ b/app/flatpages/help/api.md @@ -49,7 +49,7 @@ Tokens can be attained by visiting [Settings > API Tokens](/user/tokens/). * `content_Warnings`: List of content warning names, see [misc](#misc). * `license`: A license name. * `media_license`: A license name. - * `desc`: Long markdown description. + * `long_description`: Long markdown description. * `repo`: Git repo URL. * `website`: Website URL. * `issue_tracker`: Issue tracker URL. @@ -63,7 +63,7 @@ Examples: # Edit packages curl -X PUT http://localhost:5123/api/packages/username/name/ \ -H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" \ - -d '{ "title": "Foo bar", "tags": ["pvp", "survival"], "license": "WTFPL" }' + -d '{ "title": "Foo bar", "tags": ["pvp", "survival"], "license": "MIT" }' # Remove website URL curl -X PUT http://localhost:5123/api/packages/username/name/ \ diff --git a/app/flatpages/help/package_config.md b/app/flatpages/help/package_config.md index 97d269fe..046c922b 100644 --- a/app/flatpages/help/package_config.md +++ b/app/flatpages/help/package_config.md @@ -44,17 +44,17 @@ and for mods only: You can include a `.cdb.json` file in the root of your content directory (ie: next to a .conf) to update the package meta. -It should be a JSON dictionary with one or more of the following optional keys. +It should be a JSON dictionary with one or more of the following optional keys: * `type`: One of `GAME`, `MOD`, `TXP`. * `title`: Human-readable title. * `name`: Technical name (needs permission if already approved). * `short_description` * `tags`: List of tag names, see [/api/tags/](/api/tags/). -* `content_Warnings`: List of content warning names, see [/api/content_warnings/](/api/content_warnings/). +* `content_warnings`: List of content warning names, see [/api/content_warnings/](/api/content_warnings/). * `license`: A license name, see [/api/licenses/](/api/licenses/). * `media_license`: A license name. -* `desc`: Long markdown description. +* `description`: Long markdown description. * `repo`: Git repo URL. * `website`: Website URL. * `issue_tracker`: Issue tracker URL. @@ -68,7 +68,8 @@ Example: { "title": "Foo bar", "tags": ["pvp", "survival"], - "license": "WTFPL" + "license": "MIT", + "website": null } ``` @@ -83,8 +84,9 @@ choose Git as the method when creating a release. ### Automatic Release Creation -The preferred way is to use [webhooks from GitLab or GitHub](/help/release_webhooks/). -You can also use the [API](/help/api/) to create releases. +See [Git Update Detection](/help/update_config/). +You can also use [GitLab/GitHub webhooks](/help/release_webhooks/) or the [API](/help/api/) +to create releases. ### Min and Max Minetest Versions diff --git a/app/flatpages/help/update_config.md b/app/flatpages/help/update_config.md index 814f5ada..22a118d0 100644 --- a/app/flatpages/help/update_config.md +++ b/app/flatpages/help/update_config.md @@ -34,9 +34,10 @@ There are some situations where the settings are correct, but you want to mark a up-to-date - for example, if you don't want to make a release for a particular tag. Clicking "Save" on "Update Settings" will mark a package as up-to-date. -## Configuring +## Configuring Release Creation See the [Package Configuration and Releases Guide](/help/package_config/) for documentation on configuring the release creation. -You can set the min/max Minetest version from the Git repository, and also -configure what files are included. + +From the Git repository, you can set the min/max Minetest versions, which files are included, +and update the package meta. diff --git a/app/logic/packages.py b/app/logic/packages.py index cf7bd70c..6284b053 100644 --- a/app/logic/packages.py +++ b/app/logic/packages.py @@ -51,6 +51,7 @@ ALLOWED_FIELDS = { "content_warnings": list, "license": any, "media_license": any, + "long_description": str, "desc": str, "repo": str, "website": str, @@ -59,6 +60,13 @@ ALLOWED_FIELDS = { "forums": int, } +ALIASES = { + "short_description": "short_desc", + "issue_tracker": "issueTracker", + "long_description": "desc" +} + + def is_int(val): try: int(val) @@ -98,7 +106,7 @@ def do_edit_package(user: User, package: Package, was_new: bool, data: dict, rea not package.checkPerm(user, Permission.CHANGE_NAME): raise LogicError(403, "You do not have permission to change the package name") - for alias, to in { "short_description": "short_desc", "issue_tracker": "issueTracker" }.items(): + for alias, to in ALIASES.items(): if alias in data: data[to] = data[alias] diff --git a/app/models/packages.py b/app/models/packages.py index 499757d6..d89eb8dd 100644 --- a/app/models/packages.py +++ b/app/models/packages.py @@ -407,7 +407,7 @@ class Package(db.Model): "name": self.name, "title": self.title, "short_description": self.short_desc, - "desc": self.desc, + "long_description": self.desc, "type": self.type.toName(), "created_at": self.created_at.isoformat(),