From d58ca5743d4d1b464bf2f34a244a0b5f9569fbf3 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 10 Oct 2021 16:25:50 +0200 Subject: [PATCH] Add timezone handling Signed-off-by: Thomas Citharel --- js/package.json | 1 + js/src/components/Address/AddressInfo.vue | 124 +++++++++++ js/src/components/Event/EventFullDate.vue | 186 ++++++++++++---- js/src/components/Event/EventMap.vue | 175 +++++++++++++++ .../components/Event/EventMetadataSidebar.vue | 201 ++---------------- .../Event/FullAddressAutoComplete.vue | 152 +++++++------ js/src/components/NavBar.vue | 9 +- js/src/filters/datetime.ts | 5 +- js/src/graphql/address.ts | 1 + js/src/graphql/config.ts | 25 +++ js/src/graphql/event.ts | 1 + js/src/graphql/user.ts | 11 + js/src/i18n/en_US.json | 46 +++- js/src/i18n/fr_FR.json | 46 +++- js/src/types/address.model.ts | 16 +- js/src/types/event-options.model.ts | 3 + js/src/types/event.model.ts | 21 +- js/src/views/Event/Edit.vue | 199 ++++++++++++++--- js/src/views/Event/Event.vue | 35 ++- .../components/Post/PostElementItem.spec.ts | 2 +- js/tsconfig.json | 2 +- js/yarn.lock | 5 + lib/federation/activity_pub/actor.ex | 4 +- lib/federation/activity_pub/permission.ex | 2 +- lib/federation/activity_pub/types/events.ex | 2 +- lib/graphql/api/events.ex | 6 +- .../middleware/current_actor_provider.ex | 4 +- lib/graphql/resolvers/address.ex | 2 +- lib/graphql/resolvers/event.ex | 99 +++++++-- lib/graphql/schema/address.ex | 2 + lib/graphql/schema/event.ex | 6 +- lib/mobilizon.ex | 1 + lib/mobilizon/addresses/address.ex | 51 ++++- lib/mobilizon/events/event_options.ex | 3 + lib/mobilizon/events/events.ex | 19 +- lib/service/geospatial/addok.ex | 5 +- lib/service/geospatial/google_maps.ex | 5 +- lib/service/geospatial/map_quest.ex | 5 +- lib/service/geospatial/mimirsbrunn.ex | 3 +- lib/service/geospatial/nominatim.ex | 3 +- lib/service/geospatial/pelias.ex | 3 +- lib/service/geospatial/photon.ex | 5 +- lib/service/geospatial/provider.ex | 13 ++ lib/service/metadata/event.ex | 54 ++++- lib/service/timezone_detector.ex | 40 ++++ lib/web/auth/context.ex | 33 +-- mix.exs | 1 + mix.lock | 1 + ...211008084901_add_timezone_to_addresses.exs | 9 + 49 files changed, 1218 insertions(+), 429 deletions(-) create mode 100644 js/src/components/Address/AddressInfo.vue create mode 100644 js/src/components/Event/EventMap.vue create mode 100644 lib/service/timezone_detector.ex create mode 100644 priv/repo/migrations/20211008084901_add_timezone_to_addresses.exs diff --git a/js/package.json b/js/package.json index 9e38573e..a3d4ca10 100644 --- a/js/package.json +++ b/js/package.json @@ -38,6 +38,7 @@ "bulma-divider": "^0.2.0", "core-js": "^3.6.4", "date-fns": "^2.16.0", + "date-fns-tz": "^1.1.6", "graphql": "^15.0.0", "graphql-tag": "^2.10.3", "intersection-observer": "^0.12.0", diff --git a/js/src/components/Address/AddressInfo.vue b/js/src/components/Address/AddressInfo.vue new file mode 100644 index 00000000..a0ef9ead --- /dev/null +++ b/js/src/components/Address/AddressInfo.vue @@ -0,0 +1,124 @@ + + + diff --git a/js/src/components/Event/EventFullDate.vue b/js/src/components/Event/EventFullDate.vue index 454a3949..33c1d617 100644 --- a/js/src/components/Event/EventFullDate.vue +++ b/js/src/components/Event/EventFullDate.vue @@ -18,64 +18,97 @@ diff --git a/js/src/components/Event/EventMap.vue b/js/src/components/Event/EventMap.vue new file mode 100644 index 00000000..7ed79b3f --- /dev/null +++ b/js/src/components/Event/EventMap.vue @@ -0,0 +1,175 @@ + + + diff --git a/js/src/components/Event/EventMetadataSidebar.vue b/js/src/components/Event/EventMetadataSidebar.vue index 912038d6..1f94d5d0 100644 --- a/js/src/components/Event/EventMetadataSidebar.vue +++ b/js/src/components/Event/EventMetadataSidebar.vue @@ -11,7 +11,7 @@ {{ $t("Show map") }} @@ -24,6 +24,8 @@ :beginsOn="event.beginsOn" :show-start-time="event.options.showStartTime" :show-end-time="event.options.showEndTime" + :timezone="event.options.timezone" + :userTimezone="userTimezone" :endsOn="event.endsOn" /> @@ -130,91 +132,12 @@ > {{ extra.value }} - - - diff --git a/js/src/components/Event/FullAddressAutoComplete.vue b/js/src/components/Event/FullAddressAutoComplete.vue index b1af7d7a..48f16ead 100644 --- a/js/src/components/Event/FullAddressAutoComplete.vue +++ b/js/src/components/Event/FullAddressAutoComplete.vue @@ -1,72 +1,89 @@