Revert "Small changes to get it actually working"

This reverts commit 47a6d0e2f27bb42ec09702397bf6094b113b3c91.
This commit is contained in:
778a69cd 2023-04-03 13:18:57 +02:00
parent a4ba88d3e2
commit e3b349b117
11 changed files with 42 additions and 57 deletions

View file

@ -184,7 +184,7 @@ export const ADMIN_SETTINGS_FRAGMENT = gql`
instanceLongDescription instanceLongDescription
instanceSlogan instanceSlogan
contact contact
instanceHomepageSorting InstanceHomepageSorting
instanceTerms instanceTerms
instanceTermsType instanceTermsType
instanceTermsUrl instanceTermsUrl
@ -213,7 +213,7 @@ export const SAVE_ADMIN_SETTINGS = gql`
$instanceLongDescription: String $instanceLongDescription: String
$instanceSlogan: String $instanceSlogan: String
$contact: String $contact: String
$instanceHomepageSorting: InstanceHomepageSorting $InstanceHomepageSorting: InstanceHomepageSorting
$instanceTerms: String $instanceTerms: String
$instanceTermsType: InstanceTermsType $instanceTermsType: InstanceTermsType
$instanceTermsUrl: String $instanceTermsUrl: String
@ -230,7 +230,7 @@ export const SAVE_ADMIN_SETTINGS = gql`
instanceLongDescription: $instanceLongDescription instanceLongDescription: $instanceLongDescription
instanceSlogan: $instanceSlogan instanceSlogan: $instanceSlogan
contact: $contact contact: $contact
instanceHomepageSorting: $instanceHomepageSorting InstanceHomepageSorting: $InstanceHomepageSorting
instanceTerms: $instanceTerms instanceTerms: $instanceTerms
instanceTermsType: $instanceTermsType instanceTermsType: $instanceTermsType
instanceTermsUrl: $instanceTermsUrl instanceTermsUrl: $instanceTermsUrl

View file

@ -8,7 +8,6 @@ export const CONFIG = gql`
slogan slogan
registrationsOpen registrationsOpen
registrationsAllowlist registrationsAllowlist
instanceHomepageSorting
demoMode demoMode
countryCode countryCode
languages languages

View file

@ -25,7 +25,7 @@ export interface IAdminSettings {
instanceSlogan: string; instanceSlogan: string;
instanceLongDescription: string; instanceLongDescription: string;
contact: string; contact: string;
instanceHomepageSorting: InstanceHomepageSorting; InstanceHomepageSorting: InstanceHomepageSorting;
instanceTerms: string; instanceTerms: string;
instanceTermsType: InstanceTermsType; instanceTermsType: InstanceTermsType;
instanceTermsUrl: string | null; instanceTermsUrl: string | null;

View file

@ -64,26 +64,24 @@
<p class="content" v-else>{{ $t("Registration is closed.") }}</p> <p class="content" v-else>{{ $t("Registration is closed.") }}</p>
</b-switch> </b-switch>
</b-field> </b-field>
<div class="field">
<b-field :label="$t('Home Page Sorting')"> <b-field :label="$t('Home Page Sorting')">
<b-field> <b-field>
<b-radio <b-radio
v-model="adminSettings.instanceHomepageSorting" v-model="adminSettings.InstanceHomepageSorting"
name="instanceHomepageSorting" name="InstanceHomepageSorting"
:native-value="InstanceHomepageSorting.DEFAULT" :native-value="InstanceHomepageSorting.DEFAULT"
>{{ $t("Recently Created") }}</b-radio >{{ $t("Recently Created") }}</b-radio
> >
</b-field> </b-field>
<b-field> <b-field>
<b-radio <b-radio
v-model="adminSettings.instanceHomepageSorting" v-model="adminSettings.InstanceHomepageSorting"
name="instanceHomepageSorting" name="InstanceHomepageSorting"
:native-value="InstanceHomepageSorting.UPCOMING" :native-value="InstanceHomepageSorting.UPCOMING"
>{{ $t("Upcoming") }}</b-radio >{{ $t("Upcoming") }}</b-radio
> >
</b-field> </b-field>
</b-field> </b-field>
</div>
<div class="field"> <div class="field">
<label class="label has-help" for="instance-languages">{{ <label class="label has-help" for="instance-languages">{{
$t("Instance languages") $t("Instance languages")

View file

@ -43,15 +43,7 @@
> >
<section class="events-recent"> <section class="events-recent">
<h2 class="title"> <h2 class="title">
{{ {{ $t("Last published events") }}
$t(
config &&
config.instanceHomepageSorting ===
InstanceHomepageSorting.UPCOMING
? "Upcoming Events"
: "Last published events"
)
}}
</h2> </h2>
<p> <p>
<i18n tag="span" path="On {instance} and other federated instances"> <i18n tag="span" path="On {instance} and other federated instances">
@ -235,13 +227,10 @@
<section class="events-recent"> <section class="events-recent">
<h2 class="title"> <h2 class="title">
{{ {{
$t( adminSettings.instanceHomepageSorting ===
config && InstanceHomepageSorting.DEFAULT
config.instanceHomepageSorting === ? $t("Last published events")
InstanceHomepageSorting.UPCOMING : $t("Upcoming Events")
? "Upcoming Events"
: "Last published events"
)
}} }}
</h2> </h2>
<p> <p>
@ -295,6 +284,7 @@ import {
} from "../types/current-user.model"; } from "../types/current-user.model";
import { CURRENT_USER_CLIENT } from "../graphql/user"; import { CURRENT_USER_CLIENT } from "../graphql/user";
import { CLOSE_CONTENT, HOME_USER_QUERIES } from "../graphql/home"; import { CLOSE_CONTENT, HOME_USER_QUERIES } from "../graphql/home";
import { ADMIN_SETTINGS } from "../graphql/admin";
import RouteName from "../router/name"; import RouteName from "../router/name";
import { IEvent } from "../types/event.model"; import { IEvent } from "../types/event.model";
import DateComponent from "../components/Event/DateCalendarIcon.vue"; import DateComponent from "../components/Event/DateCalendarIcon.vue";
@ -305,10 +295,11 @@ import Subtitle from "../components/Utils/Subtitle.vue";
@Component({ @Component({
apollo: { apollo: {
adminSettings: ADMIN_SETTINGS,
events: { events: {
query: FETCH_EVENTS, query: FETCH_EVENTS,
variables() { variables() {
return this.config?.instanceHomepageSorting === return this.adminSettings?.InstanceHomepageSorting ===
InstanceHomepageSorting.UPCOMING InstanceHomepageSorting.UPCOMING
? { ? {
orderBy: EventSortField.BEGINS_ON, orderBy: EventSortField.BEGINS_ON,
@ -399,8 +390,6 @@ export default class Home extends Vue {
config!: IConfig; config!: IConfig;
InstanceHomepageSorting = InstanceHomepageSorting;
RouteName = RouteName; RouteName = RouteName;
currentUserParticipations: IParticipant[] = []; currentUserParticipations: IParticipant[] = [];

View file

@ -89,7 +89,6 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
name: Config.instance_name(), name: Config.instance_name(),
registrations_open: Config.instance_registrations_open?(), registrations_open: Config.instance_registrations_open?(),
registrations_allowlist: Config.instance_registrations_allowlist?(), registrations_allowlist: Config.instance_registrations_allowlist?(),
instance_homepage_sorting: Config.instance_homepage_sorting(),
contact: Config.contact(), contact: Config.contact(),
demo_mode: Config.instance_demo_mode?(), demo_mode: Config.instance_demo_mode?(),
description: Config.instance_description(), description: Config.instance_description(),

View file

@ -393,10 +393,10 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
arg(:instance_long_description, :string, description: "The instance's long description") arg(:instance_long_description, :string, description: "The instance's long description")
arg(:instance_slogan, :string, description: "The instance's slogan") arg(:instance_slogan, :string, description: "The instance's slogan")
arg(:contact, :string, description: "The instance's contact details") 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, :string, description: "The instance's terms body text")
arg(:instance_terms_type, :instance_terms_type, description: "The instance's terms type") 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_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, arg(:instance_privacy_policy, :string,
description: "The instance's privacy policy body text" description: "The instance's privacy policy body text"

View file

@ -48,8 +48,6 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
field(:version, :string, description: "The instance's version") field(:version, :string, description: "The instance's version")
field(:federating, :boolean, description: "Whether this instance is federation") 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 field(:terms, :terms, description: "The instance's terms") do
arg(:locale, :string, arg(:locale, :string,
default_value: "en", default_value: "en",
@ -60,6 +58,8 @@ defmodule Mobilizon.GraphQL.Schema.ConfigType do
resolve(&Config.terms/3) resolve(&Config.terms/3)
end end
field(:instance_homepage_sorting, :instance_homepage_sorting, description: "The instance's homepage sorting")
field(:privacy, :privacy, description: "The instance's privacy policy") do field(:privacy, :privacy, description: "The instance's privacy policy") do
arg(:locale, :string, arg(:locale, :string,
default_value: "en", default_value: "en",

View file

@ -411,10 +411,10 @@ defmodule Mobilizon.Config do
instance_slogan: instance_slogan(), instance_slogan: instance_slogan(),
registrations_open: instance_registrations_open?(), registrations_open: instance_registrations_open?(),
contact: contact(), contact: contact(),
instance_homepage_sorting: instance_homepage_sorting(),
instance_terms: instance_terms(), instance_terms: instance_terms(),
instance_terms_type: instance_terms_type(), instance_terms_type: instance_terms_type(),
instance_terms_url: instance_terms_url(), instance_terms_url: instance_terms_url(),
instance_homepage_sorting: instance_homepage_sorting(),
instance_privacy_policy: instance_privacy(), instance_privacy_policy: instance_privacy(),
instance_privacy_policy_type: instance_privacy_type(), instance_privacy_policy_type: instance_privacy_type(),
instance_privacy_policy_url: instance_privacy_url(), instance_privacy_policy_url: instance_privacy_url(),

View file

@ -223,15 +223,15 @@ type Config {
"Whether this instance is federation" "Whether this instance is federation"
federating: Boolean federating: Boolean
"The instance's homepage sorting"
instanceHomepageSorting: InstanceHomepageSorting
"The instance's terms" "The instance's terms"
terms( terms(
"The user's locale. The terms will be translated in their language, if available." "The user's locale. The terms will be translated in their language, if available."
locale: String locale: String
): Terms ): Terms
"The instance's homepage sorting"
instanceHomepageSorting: InstanceHomepageSorting
"The instance's privacy policy" "The instance's privacy policy"
privacy( privacy(
"The user's locale. The privacy policy will be translated in their language, if available." "The user's locale. The privacy policy will be translated in their language, if available."
@ -1953,9 +1953,6 @@ type RootMutationType {
"The instance's contact details" "The instance's contact details"
contact: String contact: String
"The instance's homepage sorting"
instanceHomepageSorting: InstanceHomepageSorting
"The instance's terms body text" "The instance's terms body text"
instanceTerms: String instanceTerms: String
@ -1965,6 +1962,9 @@ type RootMutationType {
"The instance's terms URL" "The instance's terms URL"
instanceTermsUrl: String instanceTermsUrl: String
"The instance's homepage sorting"
instanceHomepageSorting: InstanceHomepageSorting
"The instance's privacy policy body text" "The instance's privacy policy body text"
instancePrivacyPolicy: String instancePrivacyPolicy: String

View file

@ -337,7 +337,7 @@ defmodule Mobilizon.GraphQL.Resolvers.AdminTest do
instanceDescription instanceDescription
instanceLongDescription instanceLongDescription
contact contact
instanceHomepageSorting InstanceHomepageSorting
instanceTerms instanceTerms
instanceTermsType instanceTermsType
instanceTermsUrl instanceTermsUrl
@ -420,7 +420,7 @@ defmodule Mobilizon.GraphQL.Resolvers.AdminTest do
$instanceDescription: String $instanceDescription: String
$instanceLongDescription: String $instanceLongDescription: String
$contact: String $contact: String
$instanceHomepageSorting: InstanceHomepageSorting $InstanceHomepageSorting: InstanceHomepageSorting
$instanceTerms: String $instanceTerms: String
$instanceTermsType: InstanceTermsType $instanceTermsType: InstanceTermsType
$instanceTermsUrl: String $instanceTermsUrl: String
@ -435,7 +435,7 @@ defmodule Mobilizon.GraphQL.Resolvers.AdminTest do
instanceDescription: $instanceDescription instanceDescription: $instanceDescription
instanceLongDescription: $instanceLongDescription instanceLongDescription: $instanceLongDescription
contact: $contact contact: $contact
instanceHomepageSorting: $instanceHomepageSorting InstanceHomepageSorting: $InstanceHomepageSorting
instanceTerms: $instanceTerms instanceTerms: $instanceTerms
instanceTermsType: $instanceTermsType instanceTermsType: $instanceTermsType
instanceTermsUrl: $instanceTermsUrl instanceTermsUrl: $instanceTermsUrl