From 3aa10b77b39c38518d976f06b523368ce2b00770 Mon Sep 17 00:00:00 2001 From: Gitea Date: Fri, 20 Aug 2021 00:22:22 +0200 Subject: [PATCH] Added option to change sorting on homepage to upcoming (cherry picked from commit f09ede2b820dbce04c036abf582260eafba02795) upstream PR is https://framagit.org/framasoft/mobilizon/-/merge_requests/1236 --- js/src/graphql/admin.ts | 3 +++ js/src/types/admin.model.ts | 3 ++- js/src/types/config.model.ts | 8 ++++++- js/src/types/enums.ts | 5 +++++ js/src/views/Admin/Settings.vue | 26 ++++++++++++++++++++++- js/src/views/Home.vue | 30 ++++++++++++++++++++++----- lib/graphql/schema/admin.ex | 8 +++++++ lib/graphql/schema/config.ex | 2 ++ lib/mobilizon/config.ex | 6 ++++++ schema.graphql | 18 ++++++++++++++++ test/graphql/resolvers/admin_test.exs | 3 +++ 11 files changed, 104 insertions(+), 8 deletions(-) diff --git a/js/src/graphql/admin.ts b/js/src/graphql/admin.ts index 0d47b0fa7..4c6bfaecc 100644 --- a/js/src/graphql/admin.ts +++ b/js/src/graphql/admin.ts @@ -184,6 +184,7 @@ export const ADMIN_SETTINGS_FRAGMENT = gql` instanceLongDescription instanceSlogan contact + InstanceHomepageSorting instanceTerms instanceTermsType instanceTermsUrl @@ -212,6 +213,7 @@ export const SAVE_ADMIN_SETTINGS = gql` $instanceLongDescription: String $instanceSlogan: String $contact: String + $InstanceHomepageSorting: InstanceHomepageSorting $instanceTerms: String $instanceTermsType: InstanceTermsType $instanceTermsUrl: String @@ -228,6 +230,7 @@ export const SAVE_ADMIN_SETTINGS = gql` instanceLongDescription: $instanceLongDescription instanceSlogan: $instanceSlogan contact: $contact + InstanceHomepageSorting: $InstanceHomepageSorting instanceTerms: $instanceTerms instanceTermsType: $instanceTermsType instanceTermsUrl: $instanceTermsUrl diff --git a/js/src/types/admin.model.ts b/js/src/types/admin.model.ts index 00d165428..ed74b1062 100644 --- a/js/src/types/admin.model.ts +++ b/js/src/types/admin.model.ts @@ -1,6 +1,6 @@ import type { IEvent } from "@/types/event.model"; import type { IGroup } from "./actor"; -import { InstanceTermsType } from "./enums"; +import { InstanceTermsType, InstanceHomepageSorting } from "./enums"; export interface IDashboard { lastPublicEventPublished: IEvent; @@ -25,6 +25,7 @@ export interface IAdminSettings { instanceSlogan: string; instanceLongDescription: string; contact: string; + InstanceHomepageSorting: InstanceHomepageSorting; instanceTerms: string; instanceTermsType: InstanceTermsType; instanceTermsUrl: string | null; diff --git a/js/src/types/config.model.ts b/js/src/types/config.model.ts index 97544c2e5..2ceeaa5a2 100644 --- a/js/src/types/config.model.ts +++ b/js/src/types/config.model.ts @@ -1,4 +1,9 @@ -import { InstancePrivacyType, InstanceTermsType, RoutingType } from "./enums"; +import { + InstancePrivacyType, + InstanceTermsType, + InstanceHomepageSorting, + RoutingType +} from "./enums"; import type { IProvider } from "./resource"; export interface IOAuthProvider { @@ -79,6 +84,7 @@ export interface IConfig { provider: string; autocomplete: boolean; }; + instanceHomepageSorting: InstanceHomepageSorting; terms: { bodyHtml: string; type: InstanceTermsType; diff --git a/js/src/types/enums.ts b/js/src/types/enums.ts index 1061d196b..2d6f76781 100644 --- a/js/src/types/enums.ts +++ b/js/src/types/enums.ts @@ -1,4 +1,9 @@ /* eslint-disable no-unused-vars */ +export enum InstanceHomepageSorting { + DEFAULT = "DEFAULT", + UPCOMING = "UPCOMING", +} + export enum InstanceTermsType { DEFAULT = "DEFAULT", URL = "URL", diff --git a/js/src/views/Admin/Settings.vue b/js/src/views/Admin/Settings.vue index 137e7907a..d938c89db 100644 --- a/js/src/views/Admin/Settings.vue +++ b/js/src/views/Admin/Settings.vue @@ -64,6 +64,24 @@

{{ $t("Registration is closed.") }}

+ + + {{ $t("Recently Created") }} + + + {{ $t("Upcoming") }} + +