diff --git a/js/package.json b/js/package.json index f5e1d6220..9d6781b17 100644 --- a/js/package.json +++ b/js/package.json @@ -55,7 +55,7 @@ "@vue/cli-plugin-typescript": "^4.0.3", "@vue/cli-plugin-unit-mocha": "^4.0.3", "@vue/cli-service": "^4.0.3", - "@vue/eslint-config-typescript": "^4.0.0", + "@vue/eslint-config-typescript": "^5.0.0", "@vue/test-utils": "^1.0.0-beta.29", "apollo-link-error": "^1.1.12", "chai": "^4.2.0", @@ -67,8 +67,8 @@ "tslint": "^5.20.0", "tslint-config-airbnb": "^5.11.2", "typescript": "^3.6.3", - "vue-cli-plugin-styleguidist": "^3.25.0", - "vue-cli-plugin-webpack-bundle-analyzer": "^1.3.0", + "vue-cli-plugin-styleguidist": "^4.0.1", + "vue-cli-plugin-webpack-bundle-analyzer": "^2.0.0", "vue-i18n-extract": "^1.0.2", "vue-svg-inline-loader": "^1.3.0", "vue-template-compiler": "^2.6.10", diff --git a/js/src/components/Editor.vue b/js/src/components/Editor.vue index 85ad16f55..f44469bd8 100644 --- a/js/src/components/Editor.vue +++ b/js/src/components/Editor.vue @@ -387,6 +387,7 @@ export default class EditorComponent extends Vue { placement: 'top-start', inertia: true, duration: [400, 200], + // @ts-ignore for some reason showOnInit: true, arrow: true, arrowType: 'round', diff --git a/js/src/graphql/actor.ts b/js/src/graphql/actor.ts index 68e8c29b4..e26f197b6 100644 --- a/js/src/graphql/actor.ts +++ b/js/src/graphql/actor.ts @@ -70,7 +70,7 @@ query { }`; export const CURRENT_ACTOR_CLIENT = gql` - query { + query currentActor { currentActor @client { id, avatar { diff --git a/js/src/graphql/event.ts b/js/src/graphql/event.ts index b970e7300..72009bd33 100644 --- a/js/src/graphql/event.ts +++ b/js/src/graphql/event.ts @@ -289,6 +289,7 @@ export const EDIT_EVENT = gql` $picture: PictureInput, $onlineAddress: String, $phoneAddress: String, + $organizerActorId: ID, $category: String, $physicalAddress: AddressInput, $options: EventOptionsInput, @@ -307,6 +308,7 @@ export const EDIT_EVENT = gql` picture: $picture, onlineAddress: $onlineAddress, phoneAddress: $phoneAddress, + organizerActorId: $organizerActorId, category: $category, physicalAddress: $physicalAddress options: $options, diff --git a/js/src/mixins/identityEdition.ts b/js/src/mixins/identityEdition.ts new file mode 100644 index 000000000..d4f54f862 --- /dev/null +++ b/js/src/mixins/identityEdition.ts @@ -0,0 +1,35 @@ +import { Component, Mixins, Vue } from 'vue-property-decorator'; +import { Person } from '@/types/actor'; + +@Component +export default class IdentityEditionMixin extends Mixins(Vue) { + + identity = new Person(); + oldDisplayName: string | null = null; + + autoUpdateUsername(newDisplayName: string | null) { + const oldUsername = IdentityEditionMixin.convertToUsername(this.oldDisplayName); + + if (this.identity.preferredUsername === oldUsername) { + this.identity.preferredUsername = IdentityEditionMixin.convertToUsername(newDisplayName); + } + + this.oldDisplayName = newDisplayName; + } + + private static convertToUsername(value: string | null) { + if (!value) return ''; + + // https://stackoverflow.com/a/37511463 + return value.toLocaleLowerCase() + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .replace(/ /g, '_') + .replace(/[^a-z0-9_]/g, '') + ; + } + + validateUsername() { + return this.identity.preferredUsername === IdentityEditionMixin.convertToUsername(this.identity.preferredUsername); + } +} diff --git a/js/src/views/Account/IdentityPickerWrapper.vue b/js/src/views/Account/IdentityPickerWrapper.vue index 87ad24574..ef98648b7 100644 --- a/js/src/views/Account/IdentityPickerWrapper.vue +++ b/js/src/views/Account/IdentityPickerWrapper.vue @@ -10,7 +10,7 @@