- {{ $t("Last published events") }}
+ {{
+ $t(
+ config &&
+ config.instanceHomepageSorting ===
+ InstanceHomepageSorting.UPCOMING
+ ? "Upcoming Events"
+ : "Last published events"
+ )
+ }}
@@ -227,10 +235,13 @@
{{
- adminSettings.instanceHomepageSorting ===
- InstanceHomepageSorting.DEFAULT
- ? $t("Last published events")
- : $t("Upcoming Events")
+ $t(
+ config &&
+ config.instanceHomepageSorting ===
+ InstanceHomepageSorting.UPCOMING
+ ? "Upcoming Events"
+ : "Last published events"
+ )
}}
@@ -284,7 +295,6 @@ import {
} from "../types/current-user.model";
import { CURRENT_USER_CLIENT } from "../graphql/user";
import { CLOSE_CONTENT, HOME_USER_QUERIES } from "../graphql/home";
-import { ADMIN_SETTINGS } from "../graphql/admin";
import RouteName from "../router/name";
import { IEvent } from "../types/event.model";
import DateComponent from "../components/Event/DateCalendarIcon.vue";
@@ -295,11 +305,10 @@ import Subtitle from "../components/Utils/Subtitle.vue";
@Component({
apollo: {
- adminSettings: ADMIN_SETTINGS,
events: {
query: FETCH_EVENTS,
variables() {
- return this.adminSettings?.InstanceHomepageSorting ===
+ return this.config?.instanceHomepageSorting ===
InstanceHomepageSorting.UPCOMING
? {
orderBy: EventSortField.BEGINS_ON,
@@ -390,6 +399,8 @@ export default class Home extends Vue {
config!: IConfig;
+ InstanceHomepageSorting = InstanceHomepageSorting;
+
RouteName = RouteName;
currentUserParticipations: IParticipant[] = [];
diff --git a/lib/graphql/resolvers/config.ex b/lib/graphql/resolvers/config.ex
index af9bded83..13ba16a40 100644
--- a/lib/graphql/resolvers/config.ex
+++ b/lib/graphql/resolvers/config.ex
@@ -89,6 +89,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
name: Config.instance_name(),
registrations_open: Config.instance_registrations_open?(),
registrations_allowlist: Config.instance_registrations_allowlist?(),
+ instance_homepage_sorting: Config.instance_homepage_sorting(),
contact: Config.contact(),
demo_mode: Config.instance_demo_mode?(),
description: Config.instance_description(),
diff --git a/lib/graphql/schema/admin.ex b/lib/graphql/schema/admin.ex
index ad3332dc2..4db30413e 100644
--- a/lib/graphql/schema/admin.ex
+++ b/lib/graphql/schema/admin.ex
@@ -393,10 +393,10 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
arg(:instance_long_description, :string, description: "The instance's long description")
arg(:instance_slogan, :string, description: "The instance's slogan")
arg(:contact, :string, description: "The instance's contact details")
+ arg(:instance_homepage_sorting, :instance_homepage_sorting, description: "The instance's homepage sorting")
arg(:instance_terms, :string, description: "The instance's terms body text")
arg(:instance_terms_type, :instance_terms_type, description: "The instance's terms type")
arg(:instance_terms_url, :string, description: "The instance's terms URL")
- arg(:instance_homepage_sorting, :instance_homepage_sorting, description: "The instance's homepage sorting")
arg(:instance_privacy_policy, :string,
description: "The instance's privacy policy body text"
diff --git a/lib/graphql/schema/config.ex b/lib/graphql/schema/config.ex
index 3d690bb92..5c2f5d3ba 100644
--- a/lib/graphql/schema/config.ex
+++ b/lib/graphql/schema/config.ex
@@ -48,6 +48,8 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:version, :string, description: "The instance's version")
field(:federating, :boolean, description: "Whether this instance is federation")
+ field(:instance_homepage_sorting, :instance_homepage_sorting, description: "The instance's homepage sorting")
+
field(:terms, :terms, description: "The instance's terms") do
arg(:locale, :string,
default_value: "en",
@@ -58,8 +60,6 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
resolve(&Config.terms/3)
end
- field(:instance_homepage_sorting, :instance_homepage_sorting, description: "The instance's homepage sorting")
-
field(:privacy, :privacy, description: "The instance's privacy policy") do
arg(:locale, :string,
default_value: "en",
diff --git a/lib/mobilizon/config.ex b/lib/mobilizon/config.ex
index 196fdb968..1611adf98 100644
--- a/lib/mobilizon/config.ex
+++ b/lib/mobilizon/config.ex
@@ -411,10 +411,10 @@ defmodule Mobilizon.Config do
instance_slogan: instance_slogan(),
registrations_open: instance_registrations_open?(),
contact: contact(),
+ instance_homepage_sorting: instance_homepage_sorting(),
instance_terms: instance_terms(),
instance_terms_type: instance_terms_type(),
instance_terms_url: instance_terms_url(),
- instance_homepage_sorting: instance_homepage_sorting(),
instance_privacy_policy: instance_privacy(),
instance_privacy_policy_type: instance_privacy_type(),
instance_privacy_policy_url: instance_privacy_url(),
diff --git a/schema.graphql b/schema.graphql
index c3fc01259..14e0ffe55 100644
--- a/schema.graphql
+++ b/schema.graphql
@@ -223,15 +223,15 @@ type Config {
"Whether this instance is federation"
federating: Boolean
+ "The instance's homepage sorting"
+ instanceHomepageSorting: InstanceHomepageSorting
+
"The instance's terms"
terms(
"The user's locale. The terms will be translated in their language, if available."
locale: String
): Terms
- "The instance's homepage sorting"
- instanceHomepageSorting: InstanceHomepageSorting
-
"The instance's privacy policy"
privacy(
"The user's locale. The privacy policy will be translated in their language, if available."
@@ -1953,6 +1953,9 @@ type RootMutationType {
"The instance's contact details"
contact: String
+ "The instance's homepage sorting"
+ instanceHomepageSorting: InstanceHomepageSorting
+
"The instance's terms body text"
instanceTerms: String
@@ -1962,9 +1965,6 @@ type RootMutationType {
"The instance's terms URL"
instanceTermsUrl: String
- "The instance's homepage sorting"
- instanceHomepageSorting: InstanceHomepageSorting
-
"The instance's privacy policy body text"
instancePrivacyPolicy: String
diff --git a/test/graphql/resolvers/admin_test.exs b/test/graphql/resolvers/admin_test.exs
index 56c0db5d1..62cf40965 100644
--- a/test/graphql/resolvers/admin_test.exs
+++ b/test/graphql/resolvers/admin_test.exs
@@ -337,7 +337,7 @@ defmodule Mobilizon.GraphQL.Resolvers.AdminTest do
instanceDescription
instanceLongDescription
contact
- InstanceHomepageSorting
+ instanceHomepageSorting
instanceTerms
instanceTermsType
instanceTermsUrl
@@ -420,7 +420,7 @@ defmodule Mobilizon.GraphQL.Resolvers.AdminTest do
$instanceDescription: String
$instanceLongDescription: String
$contact: String
- $InstanceHomepageSorting: InstanceHomepageSorting
+ $instanceHomepageSorting: InstanceHomepageSorting
$instanceTerms: String
$instanceTermsType: InstanceTermsType
$instanceTermsUrl: String
@@ -435,7 +435,7 @@ defmodule Mobilizon.GraphQL.Resolvers.AdminTest do
instanceDescription: $instanceDescription
instanceLongDescription: $instanceLongDescription
contact: $contact
- InstanceHomepageSorting: $InstanceHomepageSorting
+ instanceHomepageSorting: $instanceHomepageSorting
instanceTerms: $instanceTerms
instanceTermsType: $instanceTermsType
instanceTermsUrl: $instanceTermsUrl