revert all changes that lead to configurable homepage sorting, except!

for the changes to elixir code, as it turns out altering the graphql
schema will break existing web clients. We have to remove that change
later in a few months from now (2023-04-23).

Revert "make i18n work for upstream PR https://framagit.org/framasoft/mobilizon/-/merge_requests/1236"

This reverts commit fc2c2db21c9b6e00c2142552f10d7cd2de27fd1d.

Revert "fixup a detail for upstream PR https://framagit.org/framasoft/mobilizon/-/merge_requests/1236"

This reverts commit e34f9d1796d07f228da60ee770f795ce42c3423e.

Revert "Changed interface to consts"

This reverts commit e40558ce7895d29bf831df68520ea0e95fd8667c.

Revert "Extracting sorting modes into its own model"

This reverts commit 839f9fd3f23027bfc00551f22ab0e52c5b63087f.

Revert "Reformatted ex files"

This reverts commit 8e4f698532889323c8b649fe421f413ac3dc3a75.

Revert "Small changes to get it actually working"

This reverts commit 47a6d0e2f27bb42ec09702397bf6094b113b3c91.

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

This reverts commit fa6d875bb47e9e21fd82c3eed7d0a7303e32ddfb.

Revert "increase amount of displayed events on start page"

This reverts commit e84ed5fb7a480fe4ac13a8617542199ad7040154.
This commit is contained in:
778a69cd 2023-04-23 01:42:03 +02:00
parent 595a3dca8b
commit a129d71b29
10 changed files with 10 additions and 79 deletions

View file

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

@ -1020,7 +1020,6 @@
"Upcoming": "Demnächst", "Upcoming": "Demnächst",
"Upcoming events": "Bevorstehende Veranstaltungen", "Upcoming events": "Bevorstehende Veranstaltungen",
"Upcoming events from your groups": "Bevorstehende Veranstaltungen deiner Gruppen", "Upcoming events from your groups": "Bevorstehende Veranstaltungen deiner Gruppen",
"Recently created events": "Zuletzt erstellte Veranstaltungen",
"Update": "Update", "Update": "Update",
"Update app": "App aktualisieren", "Update app": "App aktualisieren",
"Update discussion title": "Überschrift der Diskussion aktualisieren", "Update discussion title": "Überschrift der Diskussion aktualisieren",

View file

@ -430,7 +430,6 @@
"Actor": "Actor", "Actor": "Actor",
"Text": "Text", "Text": "Text",
"Upcoming events": "Upcoming events", "Upcoming events": "Upcoming events",
"Recently created events": "Recently created events",
"Resources": "Resources", "Resources": "Resources",
"Public page": "Public page", "Public page": "Public page",
"Discussions": "Discussions", "Discussions": "Discussions",

View file

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

View file

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

View file

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

View file

@ -1,13 +0,0 @@
import { EventSortField, SortDirection } from "./enums";
export const SORTING_UPCOMING = {
title: "Upcoming events",
orderBy: EventSortField.BEGINS_ON,
direction: SortDirection.ASC,
};
export const SORTING_CREATED = {
title: "Recently created events",
orderBy: EventSortField.INSERTED_AT,
direction: SortDirection.DESC,
};

View file

@ -64,26 +64,6 @@
<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>
<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>
<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")
@ -395,11 +375,7 @@ import {
SAVE_ADMIN_SETTINGS, SAVE_ADMIN_SETTINGS,
LANGUAGES, LANGUAGES,
} from "@/graphql/admin"; } from "@/graphql/admin";
import { import { InstancePrivacyType, InstanceTermsType } from "@/types/enums";
InstanceHomepageSorting,
InstancePrivacyType,
InstanceTermsType,
} from "@/types/enums";
import { IAdminSettings, ILanguage } from "../../types/admin.model"; import { IAdminSettings, ILanguage } from "../../types/admin.model";
import RouteName from "../../router/name"; import RouteName from "../../router/name";
@ -430,7 +406,6 @@ export default class Settings extends Vue {
instanceRules: "", instanceRules: "",
registrationsOpen: false, registrationsOpen: false,
instanceLanguages: [], instanceLanguages: [],
instanceHomepageSorting: InstanceHomepageSorting.DEFAULT,
}; };
settingsToWrite: IAdminSettings = { ...this.adminSettings }; settingsToWrite: IAdminSettings = { ...this.adminSettings };
@ -444,8 +419,6 @@ export default class Settings extends Vue {
filteredLanguages: string[] = []; filteredLanguages: string[] = [];
InstanceHomepageSorting = InstanceHomepageSorting;
InstanceTermsType = InstanceTermsType; InstanceTermsType = InstanceTermsType;
InstancePrivacyType = InstancePrivacyType; InstancePrivacyType = InstancePrivacyType;

View file

@ -43,7 +43,7 @@
> >
<section class="events-recent"> <section class="events-recent">
<h2 class="title"> <h2 class="title">
{{ $t(this.sorting.title) }} {{ $t("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">
@ -226,7 +226,7 @@
/> />
<section class="events-recent"> <section class="events-recent">
<h2 class="title"> <h2 class="title">
{{ $t(this.sorting.title) }} {{ $t("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,7 +235,7 @@
</p> </p>
<div v-if="events.total > 0"> <div v-if="events.total > 0">
<multi-card :events="events.elements.slice(0, 32)" /> <multi-card :events="events.elements.slice(0, 8)" />
<span class="view-all"> <span class="view-all">
<router-link :to="{ name: RouteName.SEARCH }" <router-link :to="{ name: RouteName.SEARCH }"
>{{ $t("View everything") }} >></router-link >{{ $t("View everything") }} >></router-link
@ -258,7 +258,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue, Watch } from "vue-property-decorator"; import { Component, Vue, Watch } from "vue-property-decorator";
import { InstanceHomepageSorting, ParticipantRole } from "@/types/enums"; import { EventSortField, ParticipantRole, SortDirection } from "@/types/enums";
import { Paginate } from "@/types/paginate"; import { Paginate } from "@/types/paginate";
import { supportsWebPFormat } from "@/utils/support"; import { supportsWebPFormat } from "@/utils/support";
import { IParticipant, Participant } from "../types/participant.model"; import { IParticipant, Participant } from "../types/participant.model";
@ -278,7 +278,6 @@ 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";
import { CONFIG } from "../graphql/config"; import { CONFIG } from "../graphql/config";
import { SORTING_UPCOMING, SORTING_CREATED } from "../types/sorting.model";
import { IConfig } from "../types/config.model"; import { IConfig } from "../types/config.model";
import { IFollowedGroupEvent } from "../types/followedGroupEvent.model"; import { IFollowedGroupEvent } from "../types/followedGroupEvent.model";
import Subtitle from "../components/Utils/Subtitle.vue"; import Subtitle from "../components/Utils/Subtitle.vue";
@ -287,8 +286,9 @@ import Subtitle from "../components/Utils/Subtitle.vue";
apollo: { apollo: {
events: { events: {
query: FETCH_EVENTS, query: FETCH_EVENTS,
variables() { variables: {
return this.sorting; orderBy: EventSortField.INSERTED_AT,
direction: SortDirection.DESC,
}, },
}, },
currentActor: { currentActor: {
@ -370,8 +370,6 @@ export default class Home extends Vue {
config!: IConfig; config!: IConfig;
InstanceHomepageSorting = InstanceHomepageSorting;
RouteName = RouteName; RouteName = RouteName;
currentUserParticipations: IParticipant[] = []; currentUserParticipations: IParticipant[] = [];
@ -457,15 +455,6 @@ export default class Home extends Vue {
); );
} }
get sorting() {
switch (this.config?.instanceHomepageSorting) {
case InstanceHomepageSorting.UPCOMING:
return SORTING_UPCOMING;
default:
return SORTING_CREATED;
}
}
get thisWeekGoingToEvents(): IParticipant[] { get thisWeekGoingToEvents(): IParticipant[] {
const res = this.currentUserParticipations.filter( const res = this.currentUserParticipations.filter(
({ event, role }) => ({ event, role }) =>