From f5c3dbf128bb9b05b71a2de6ac3c97ae1c1ffb5d Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 4 Sep 2019 18:24:31 +0200 Subject: [PATCH] Correctly handle event update Signed-off-by: Thomas Citharel --- .../components/Event/AddressAutoComplete.vue | 3 +- js/src/components/Event/TagInput.vue | 50 ++++++----- js/src/graphql/event.ts | 50 ++++++++++- js/src/types/event.model.ts | 12 +-- js/src/views/Event/Edit.vue | 13 +-- js/src/views/Event/Event.vue | 2 +- lib/mobilizon/actors/actor.ex | 18 ++++ lib/mobilizon/actors/actors.ex | 2 +- lib/mobilizon/events/event.ex | 36 +++++++- lib/mobilizon/events/events.ex | 10 ++- lib/mobilizon_web/api/events.ex | 60 ++++++-------- lib/mobilizon_web/api/groups.ex | 6 +- lib/mobilizon_web/resolvers/event.ex | 14 +++- lib/mobilizon_web/schema/event.ex | 6 +- lib/service/activity_pub/activity_pub.ex | 23 ++---- lib/service/activity_pub/converters/actor.ex | 22 ++++- lib/service/activity_pub/converters/event.ex | 4 +- lib/service/activity_pub/transmogrifier.ex | 32 ++++++-- lib/service/activity_pub/utils.ex | 55 +++++++++++-- schema.graphql | 46 ++++++++--- test/fixtures/mastodon-update.json | 26 +++--- test/mobilizon/actors/actors_test.exs | 4 - .../activity_pub/activity_pub_test.exs | 42 +++++++++- .../activity_pub/converters/actor_test.exs | 2 +- .../activity_pub/transmogrifier_test.exs | 30 ++++++- .../resolvers/event_resolver_test.exs | 82 +++++++++++++++++-- test/support/factory.ex | 4 +- 27 files changed, 493 insertions(+), 161 deletions(-) diff --git a/js/src/components/Event/AddressAutoComplete.vue b/js/src/components/Event/AddressAutoComplete.vue index 5dc47ea5b..76197a2d0 100644 --- a/js/src/components/Event/AddressAutoComplete.vue +++ b/js/src/components/Event/AddressAutoComplete.vue @@ -81,11 +81,12 @@ import { Modal } from 'buefy/dist/components/dialog'; export default class AddressAutoComplete extends Vue { @Prop({ required: false, default: () => [] }) initialData!: IAddress[]; + @Prop({ required: false }) value!: IAddress; data: IAddress[] = this.initialData; selected: IAddress|null = new Address(); isFetching: boolean = false; - queryText: string = ''; + queryText: string = this.value && this.value.description || ''; addressModalActive: boolean = false; async getAsyncData(query) { diff --git a/js/src/components/Event/TagInput.vue b/js/src/components/Event/TagInput.vue index 0a5f556df..385f4d38f 100644 --- a/js/src/components/Event/TagInput.vue +++ b/js/src/components/Event/TagInput.vue @@ -1,33 +1,51 @@