Merge branch 'small-fixes' into 'master'

Small fixes

See merge request framasoft/mobilizon!864
This commit is contained in:
Thomas Citharel 2021-03-17 08:20:24 +00:00
commit 0f1c174614
7 changed files with 45 additions and 8 deletions

View File

@ -91,6 +91,8 @@ config :mobilizon, :instance,
# config :mobilizon, :activitypub, sign_object_fetches: false # config :mobilizon, :activitypub, sign_object_fetches: false
config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "uploads"
config :mobilizon, :anonymous, config :mobilizon, :anonymous,
reports: [ reports: [
allowed: true allowed: true

View File

@ -193,8 +193,8 @@ export const FETCH_EVENT_BASIC = gql`
`; `;
export const FETCH_EVENTS = gql` export const FETCH_EVENTS = gql`
query { query FetchEvents($orderBy: EventOrderBy, $direction: SortDirection) {
events { events(orderBy: $orderBy, direction: $direction) {
total total
elements { elements {
id id

View File

@ -239,3 +239,14 @@ export enum ActivityGroupSubject {
GROUP_CREATED = "group_created", GROUP_CREATED = "group_created",
GROUP_UPDATED = "group_updated", GROUP_UPDATED = "group_updated",
} }
export enum EventSortField {
BEGINS_ON = "BEGINS_ON",
INSERTED_AT = "INSERTED_AT",
UPDATED_AT = "UPDATED_AT",
}
export enum SortDirection {
ASC = "ASC",
DESC = "DESC",
}

View File

@ -320,7 +320,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue, Watch } from "vue-property-decorator"; import { Component, Vue, Watch } from "vue-property-decorator";
import { 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";
@ -347,6 +347,10 @@ import Subtitle from "../components/Utils/Subtitle.vue";
events: { events: {
query: FETCH_EVENTS, query: FETCH_EVENTS,
fetchPolicy: "no-cache", // Debug me: https://github.com/apollographql/apollo-client/issues/3030 fetchPolicy: "no-cache", // Debug me: https://github.com/apollographql/apollo-client/issues/3030
variables: {
orderBy: EventSortField.INSERTED_AT,
direction: SortDirection.DESC,
},
}, },
currentActor: { currentActor: {
query: CURRENT_ACTOR_CLIENT, query: CURRENT_ACTOR_CLIENT,

View File

@ -59,9 +59,7 @@
<b-field grouped> <b-field grouped>
<b-field :label="$t('City or region')" expanded> <b-field :label="$t('City or region')" expanded>
<address-auto-complete <address-auto-complete
v-if=" v-if="loggedUser && loggedUser.settings"
loggedUser && loggedUser.settings && loggedUser.settings.location
"
:type="AddressSearchType.ADMINISTRATIVE" :type="AddressSearchType.ADMINISTRATIVE"
:doGeoLocation="false" :doGeoLocation="false"
v-model="address" v-model="address"

View File

@ -59,9 +59,13 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
end end
end end
def list_events(_parent, %{page: page, limit: limit}, _resolution) def list_events(
_parent,
%{page: page, limit: limit, order_by: order_by, direction: direction},
_resolution
)
when limit < @event_max_limit do when limit < @event_max_limit do
{:ok, Events.list_events(page, limit)} {:ok, Events.list_events(page, limit, order_by, direction)}
end end
def list_events(_parent, %{page: _page, limit: _limit}, _resolution) do def list_events(_parent, %{page: _page, limit: _limit}, _resolution) do

View File

@ -297,11 +297,29 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
field(:id, :string, description: "The Contact Actor ID") field(:id, :string, description: "The Contact Actor ID")
end end
@desc "Available event sort fields"
enum :event_order_by do
value(:begins_on, description: "Sort by the date the event starts")
value(:inserted_at, description: "Sort by the date the event was created")
value(:updated_at, description: "Sort by the date the event was updated")
end
object :event_queries do object :event_queries do
@desc "Get all events" @desc "Get all events"
field :events, :paginated_event_list do field :events, :paginated_event_list do
arg(:page, :integer, default_value: 1, description: "The page in the paginated event list") arg(:page, :integer, default_value: 1, description: "The page in the paginated event list")
arg(:limit, :integer, default_value: 10, description: "The limit of events per page") arg(:limit, :integer, default_value: 10, description: "The limit of events per page")
arg(:order_by, :event_order_by,
default_value: :begins_on,
description: "Order the list of events by field"
)
arg(:direction, :sort_direction,
default_value: :asc,
description: "Direction for the sort"
)
resolve(&Event.list_events/3) resolve(&Event.list_events/3)
end end