Revert "Added option to change sorting on homepage to upcoming"

This reverts commit fa6d875bb47e9e21fd82c3eed7d0a7303e32ddfb.
This commit is contained in:
778a69cd 2023-04-03 13:19:09 +02:00
parent e3b349b117
commit 8288c235d0
11 changed files with 8 additions and 104 deletions

View file

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

View file

@ -1,6 +1,6 @@
import type { IEvent } from "@/types/event.model";
import type { IGroup } from "./actor";
import { InstanceTermsType, InstanceHomepageSorting } from "./enums";
import { InstanceTermsType } from "./enums";
export interface IDashboard {
lastPublicEventPublished: IEvent;
@ -25,7 +25,6 @@ export interface IAdminSettings {
instanceSlogan: string;
instanceLongDescription: string;
contact: string;
InstanceHomepageSorting: InstanceHomepageSorting;
instanceTerms: string;
instanceTermsType: InstanceTermsType;
instanceTermsUrl: string | null;

View file

@ -1,9 +1,4 @@
import {
InstancePrivacyType,
InstanceTermsType,
InstanceHomepageSorting,
RoutingType
} from "./enums";
import { InstancePrivacyType, InstanceTermsType, RoutingType } from "./enums";
import type { IProvider } from "./resource";
export interface IOAuthProvider {
@ -84,7 +79,6 @@ export interface IConfig {
provider: string;
autocomplete: boolean;
};
instanceHomepageSorting: InstanceHomepageSorting;
terms: {
bodyHtml: string;
type: InstanceTermsType;

View file

@ -1,9 +1,4 @@
/* eslint-disable no-unused-vars */
export enum InstanceHomepageSorting {
DEFAULT = "DEFAULT",
UPCOMING = "UPCOMING",
}
export enum InstanceTermsType {
DEFAULT = "DEFAULT",
URL = "URL",

View file

@ -64,24 +64,6 @@
<p class="content" v-else>{{ $t("Registration is closed.") }}</p>
</b-switch>
</b-field>
<b-field :label="$t('Home Page Sorting')">
<b-field>
<b-radio
v-model="adminSettings.InstanceHomepageSorting"
name="InstanceHomepageSorting"
:native-value="InstanceHomepageSorting.DEFAULT"
>{{ $t("Recently Created") }}</b-radio
>
</b-field>
<b-field>
<b-radio
v-model="adminSettings.InstanceHomepageSorting"
name="InstanceHomepageSorting"
:native-value="InstanceHomepageSorting.UPCOMING"
>{{ $t("Upcoming") }}</b-radio
>
</b-field>
</b-field>
<div class="field">
<label class="label has-help" for="instance-languages">{{
$t("Instance languages")
@ -393,11 +375,7 @@ import {
SAVE_ADMIN_SETTINGS,
LANGUAGES,
} from "@/graphql/admin";
import {
InstanceHomepageSorting,
InstancePrivacyType,
InstanceTermsType,
} from "@/types/enums";
import { InstancePrivacyType, InstanceTermsType } from "@/types/enums";
import { IAdminSettings, ILanguage } from "../../types/admin.model";
import RouteName from "../../router/name";
@ -441,8 +419,6 @@ export default class Settings extends Vue {
filteredLanguages: string[] = [];
InstanceHomepageSorting = InstanceHomepageSorting;
InstanceTermsType = InstanceTermsType;
InstancePrivacyType = InstancePrivacyType;

View file

@ -226,12 +226,7 @@
/>
<section class="events-recent">
<h2 class="title">
{{
adminSettings.instanceHomepageSorting ===
InstanceHomepageSorting.DEFAULT
? $t("Last published events")
: $t("Upcoming Events")
}}
{{ $t("Last published events") }}
</h2>
<p>
<i18n tag="span" path="On {instance} and other federated instances">
@ -263,12 +258,7 @@
<script lang="ts">
import { Component, Vue, Watch } from "vue-property-decorator";
import {
EventSortField,
InstanceHomepageSorting,
ParticipantRole,
SortDirection,
} from "@/types/enums";
import { EventSortField, ParticipantRole, SortDirection } from "@/types/enums";
import { Paginate } from "@/types/paginate";
import { supportsWebPFormat } from "@/utils/support";
import { IParticipant, Participant } from "../types/participant.model";
@ -284,7 +274,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,20 +284,11 @@ import Subtitle from "../components/Utils/Subtitle.vue";
@Component({
apollo: {
adminSettings: ADMIN_SETTINGS,
events: {
query: FETCH_EVENTS,
variables() {
return this.adminSettings?.InstanceHomepageSorting ===
InstanceHomepageSorting.UPCOMING
? {
orderBy: EventSortField.BEGINS_ON,
direction: SortDirection.ASC,
}
: {
orderBy: EventSortField.INSERTED_AT,
direction: SortDirection.DESC,
};
variables: {
orderBy: EventSortField.INSERTED_AT,
direction: SortDirection.DESC,
},
},
currentActor: {

View file

@ -114,7 +114,6 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
field(:instance_long_description, :string, description: "The instance's long description")
field(:instance_slogan, :string, description: "The instance's slogan")
field(:contact, :string, description: "The instance's contact details")
field(:instance_homepage_sorting, :instance_homepage_sorting, description: "The instance's homepage sorting")
field(:instance_terms, :string, description: "The instance's terms body text")
field(:instance_terms_type, :instance_terms_type, description: "The instance's terms type")
field(:instance_terms_url, :string, description: "The instance's terms URL")
@ -140,12 +139,6 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
value(:custom, as: "CUSTOM", description: "Custom terms text")
end
@desc "The acceptable values for the instance's homepage type"
enum :instance_homepage_sorting do
value(:default, as: "DEFAULT", description: "Sort by recently created")
value(:upcoming, as: "UPCOMING", description: "Sort by upcoming")
end
@desc """
The acceptable values for the instance privacy policy type
"""
@ -396,7 +389,6 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
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"

View file

@ -58,8 +58,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",

View file

@ -63,11 +63,6 @@ defmodule Mobilizon.Config do
Mobilizon.Admin.get_admin_setting_value("instance", "contact")
end
@spec instance_homepage_sorting :: String.t()
def instance_homepage_sorting do
Mobilizon.Admin.get_admin_setting_value("instance", "instance_homepage_sorting", "DEFAULT")
end
@spec instance_terms(String.t()) :: String.t()
def instance_terms(locale \\ "en") do
Mobilizon.Admin.get_admin_setting_value("instance", "instance_terms", generate_terms(locale))
@ -414,7 +409,6 @@ defmodule Mobilizon.Config do
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(),

View file

@ -229,9 +229,6 @@ type Config {
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."
@ -272,15 +269,6 @@ type Tag {
related: [Tag]
}
"The acceptable values for the instance's homepage type"
enum InstanceHomepageSorting {
"Sort by recently created"
DEFAULT
"Sort by upcoming"
UPCOMING
}
"Instance map routing configuration"
type Routing {
"The instance's routing type"
@ -1962,9 +1950,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
@ -3820,9 +3805,6 @@ type AdminSettings {
"The instance's contact details"
contact: String
"The instance's homepage sorting"
instanceHomepageSorting: InstanceHomepageSorting
"The instance's terms body text"
instanceTerms: String

View file

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