From 9c2c8c21f1e3b412328f05629204a7cf105236c4 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 3 Feb 2019 12:59:33 +0000 Subject: [PATCH] Add content flag support in the API --- app/flatpages/help.md | 2 +- app/flatpages/help/content_flags.md | 26 ++++++++++++++++++++++++++ app/flatpages/help/content_ratings.md | 11 ----------- app/querybuilder.py | 4 +++- 4 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 app/flatpages/help/content_flags.md delete mode 100644 app/flatpages/help/content_ratings.md diff --git a/app/flatpages/help.md b/app/flatpages/help.md index 7c78f34..553111d 100644 --- a/app/flatpages/help.md +++ b/app/flatpages/help.md @@ -2,5 +2,5 @@ title: Help * [Package Tags](package_tags) * [Ranks and Permissions](ranks_permissions) -* [Content Ratings](content_ratings) +* [Content Ratings and Flags](content_flags) * [Reporting Content](reporting) diff --git a/app/flatpages/help/content_flags.md b/app/flatpages/help/content_flags.md new file mode 100644 index 0000000..ef20dbc --- /dev/null +++ b/app/flatpages/help/content_flags.md @@ -0,0 +1,26 @@ +title: Content Flags + +Content flags allow you to hide content based on your preferences. +The filtering is done server-side, which means that you don't need to update +your client to use new flags. + +## Flags + +* `nonfree` - can be used to hide packages which do not qualify as + 'free software', as defined by the Free Software Foundation. +* A content rating, given below. + + +## Ratings + +Content ratings aren't currently supported by ContentDB. +Instead, mature content isn't allowed at all for now. + +In the future, more mature content will be allowed but labelled with +content ratings which may contain the following: + +* android_default - meta-rating which includes gore and drugs. +* desktop_default - meta-rating which won't include anything for now. +* gore - more than just blood +* drugs +* swearing diff --git a/app/flatpages/help/content_ratings.md b/app/flatpages/help/content_ratings.md deleted file mode 100644 index af34657..0000000 --- a/app/flatpages/help/content_ratings.md +++ /dev/null @@ -1,11 +0,0 @@ -title: Content Ratings - -Content ratings aren't currently supported by ContentDB. -Instead, mature content isn't allowed at all for now. - -Possible future ratings: - -* mature - meta-rating which includes gore and drugs -* gore - more than just blood -* drugs -* swearing diff --git a/app/querybuilder.py b/app/querybuilder.py index 408d95d..be1a1ac 100644 --- a/app/querybuilder.py +++ b/app/querybuilder.py @@ -19,12 +19,14 @@ class QueryBuilder: if len(types) > 0: title = ", ".join([type.value + "s" for type in types]) + hide_flags = args.getlist("hide") + self.title = title self.types = types self.search = args.get("q") self.random = "random" in args self.lucky = self.random or "lucky" in args - self.hide_nonfree = isNo(args.get("nonfree")) + self.hide_nonfree = "nonfree" in hide_flags self.limit = 1 if self.lucky else None self.order_by = args.get("sort") or "score" self.order_dir = args.get("order") or "desc"