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
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

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

View file

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

View file

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

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

@ -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>
</b-switch>
</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">
<label class="label has-help" for="instance-languages">{{
$t("Instance languages")
@ -395,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";
@ -430,7 +406,6 @@ export default class Settings extends Vue {
instanceRules: "",
registrationsOpen: false,
instanceLanguages: [],
instanceHomepageSorting: InstanceHomepageSorting.DEFAULT,
};
settingsToWrite: IAdminSettings = { ...this.adminSettings };
@ -444,8 +419,6 @@ export default class Settings extends Vue {
filteredLanguages: string[] = [];
InstanceHomepageSorting = InstanceHomepageSorting;
InstanceTermsType = InstanceTermsType;
InstancePrivacyType = InstancePrivacyType;

View file

@ -43,7 +43,7 @@
>
<section class="events-recent">
<h2 class="title">
{{ $t(this.sorting.title) }}
{{ $t("Last published events") }}
</h2>
<p>
<i18n tag="span" path="On {instance} and other federated instances">
@ -226,7 +226,7 @@
/>
<section class="events-recent">
<h2 class="title">
{{ $t(this.sorting.title) }}
{{ $t("Last published events") }}
</h2>
<p>
<i18n tag="span" path="On {instance} and other federated instances">
@ -235,7 +235,7 @@
</p>
<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">
<router-link :to="{ name: RouteName.SEARCH }"
>{{ $t("View everything") }} >></router-link
@ -258,7 +258,7 @@
<script lang="ts">
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 { supportsWebPFormat } from "@/utils/support";
import { IParticipant, Participant } from "../types/participant.model";
@ -278,7 +278,6 @@ import RouteName from "../router/name";
import { IEvent } from "../types/event.model";
import DateComponent from "../components/Event/DateCalendarIcon.vue";
import { CONFIG } from "../graphql/config";
import { SORTING_UPCOMING, SORTING_CREATED } from "../types/sorting.model";
import { IConfig } from "../types/config.model";
import { IFollowedGroupEvent } from "../types/followedGroupEvent.model";
import Subtitle from "../components/Utils/Subtitle.vue";
@ -287,8 +286,9 @@ import Subtitle from "../components/Utils/Subtitle.vue";
apollo: {
events: {
query: FETCH_EVENTS,
variables() {
return this.sorting;
variables: {
orderBy: EventSortField.INSERTED_AT,
direction: SortDirection.DESC,
},
},
currentActor: {
@ -370,8 +370,6 @@ export default class Home extends Vue {
config!: IConfig;
InstanceHomepageSorting = InstanceHomepageSorting;
RouteName = RouteName;
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[] {
const res = this.currentUserParticipations.filter(
({ event, role }) =>